• 等级
  • 216351 访问
  • 394 原创
  • 0 转发
  • 6674 排名
  • 32 评论
  • 22 获赞

KNN算法

前言 这里用的数据集共四列,前三列代表三个特征,每一个特征都是一列浮点数,表示这个特征的值,最后一列是标签。代码部分根据修行的猫_zq改写而成。 代码部分 #coding=utf-8 import numpy as np import operator def classify(inX,dataSet,labels,k): m,n=dataSet.shape diffMat=np...

2018-12-27 19:41:43

《Same Representation,Different Attentions:Shareable Sentence Representation》阅读笔记

之后会不定期分享论文笔记。 摘要 不同的任务句子表示不同,而且句子表示受限于不多的训练数据。论文提出一个橘子表示的模型可以用于多种任务。所有任务分享相同的句子表示,每个任务可以从共享的句子表示中利用attention机制抽取任务特定的信息。每个任务注意力机制的问题向量可以是静态的参数也可以是动态的。论文在16个不同的文本分类任务中做实验,并取得了很好的效果。 背景 词向量在多个任务中已经有...

2018-12-26 14:36:37

退役了

快半年没写博客了,省赛打完退役了。回顾这两年多的ACM,感觉收获挺多,比刚入大学的我强了不少,但是还是很菜。现在想来还是怀念坐在机房听着缘之空插曲敲着代码的日子,早早地来到机房补bc或者cf的题,学习各种算法,感觉自己学会了各种忍术(笑)。做题目的日子很纯粹,没有烦心事,红色的ACCEPTED带来的感动至今难忘,那种感觉真的挺好。和很多大神组过队,打省赛感觉自己更多的是在一旁翻译题目,插不上手(摊...

2018-12-11 12:33:52

hdu4126Genghis Khan the Conqueror (最小生成树+树形dp)

Time Limit: 10000/5000 MS (Java/Others)    Memory Limit: 327680/327680 K (Java/Others) Total Submission(s): 2524    Accepted Submission(s): 760 Problem Description Genghis Khan(成吉思汗)(1162-1

2016-09-22 17:17:50

hdu5886Tower Defence(树形dp)

Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 242    Accepted Submission(s): 80 Problem Description There was a civil war between

2016-09-20 15:10:20

hdu5893 List wants to travel(树链剖分+线段树)

Time Limit: 6000/3000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others) Total Submission(s): 270    Accepted Submission(s): 47 Problem Description A boy named List who is perf

2016-09-19 14:40:32

hdu5884 Sort(二分)

Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 547    Accepted Submission(s): 101 Problem Description Recently, Bob has just learnt

2016-09-17 20:38:07

hdu3559 Frost Chain (概率dp+记忆化搜索)

Problem Description In the unimaginable popular DotA game, the hero Lich has a wonderful skill: Frost Chain, release a jumping breath of frost that jumps N times against enemy units. Today

2016-08-21 16:56:45

hdu5790 Prefix(Trie树+主席树)

Problem Description Alice gets N strings. Now she has Q questions to ask you. For each question, she wanna know how many different prefix strings between Lth and Rth strings. It's so easy right? So

2016-08-03 19:18:18

hdu5726 GCD(gcd +二分+rmq)

Problem Description Give you a sequence of N(N≤100,000) integers : a1,...,an(0ai≤1000,000,000). There are Q(Q≤100,000) queries. For each query l,r you have to calculate gcd(al,,al+1,...,ar)

2016-07-19 20:40:59

UVA 10480 Sabotage (最大流最小割)

题目链接:点击打开链接 题意:把一个图分成两部分,要把点1和点2分开。隔断每条边都有一个花费,求最小花费的情况下,应该切断那些边。 这题很明显是最小割,也就是最大流。把1当成源点,2当成汇点。 问题是要求最小割应该隔断那条边。 思路:求最小割就是求最大流,求完后,剩余网络中,能由起点到达的是和起点一个集合的,其他的都是和终点一个集合的。 #include #include #includ

2016-07-19 11:54:06

bzoj2002 [Hnoi2010]Bounce 弹飞绵羊 (分块)

Time Limit: 10 Sec  Memory Limit: 259 MB Submit: 7896  Solved: 4124 [Submit][Status][Discuss] Description 某天,Lostmonkey发明了一种超级弹力装置,为了在他的绵羊朋友面前显摆,他邀请小绵羊一起玩个游戏。游戏一开始,Lostmonkey在地上沿着一条直线摆上n个装置,每个装置

2016-07-18 21:05:38

poj3580 SuperMemo (Splay+区间内向一个方向移动)

Time Limit: 5000MS   Memory Limit: 65536K Total Submissions: 13550   Accepted: 4248 Case Time Limit: 2000MS Description Your friend, Jackson is invited to a TV show called Su

2016-05-19 22:02:15

bzoj1500: [NOI2005]维修数列 (Splay+变态题)

Time Limit: 10 Sec  Memory Limit: 64 MB Submit: 11353  Solved: 3553 [Submit][Status][Discuss] Description Input 输入的第1 行包含两个数N 和M(M ≤20 000),N 表示初始时数列中数的个数,M表示要进行的操作数目。 第2行包含N个数字,描述初始时的数列

2016-05-18 16:29:01

hdu3436 Queue-jumpers(Splay)

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 3411    Accepted Submission(s): 923 Problem Description Ponyo and Garfield are waiti

2016-05-17 14:35:10

hdu4710 Balls Rearrangement(数学公式+取模)

Balls Rearrangement Time Limit: 6000/3000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 945    Accepted Submission(s): 380 Problem Description Bob has

2016-05-15 19:24:30

hdu1890 Robotic Sort (splay+区间翻转单点更新)

Problem Description Somewhere deep in the Czech Technical University buildings, there are laboratories for examining mechanical and electrical properties of various materials. In one of yesterday’s

2016-05-13 11:39:28

zoj2112 Dynamic Rankings (主席树 || 树套树)

The Company Dynamic Rankings has developed a new kind of computer that is no longer satisfied with the query like to simply find the k-th smallest number of the given N numbers. They have developed

2016-05-05 20:52:36

poj3581 Sequence (后缀数组)

Time Limit: 5000MS   Memory Limit: 65536K Total Submissions: 6305   Accepted: 1364 Case Time Limit: 2000MS Description Given a sequence, {A1, A2, ..., An} which is guaranteed

2016-05-02 20:46:07

UVA 11475 Extend to Palindrome (kmp || manacher || 后缀数组)

题目链接:点击打开链接 题意:给你一个串,让你在串后面添加尽可能少的字符使得这个串变成回文串。 思路:这题可以kmp,manacher,后缀数组三种方法都可以做,kmp和manacher效率较高,时间复杂度是O(n),后缀数组时间复杂度是O(nlogn).思路是求出元串的后缀和反串的前缀匹配的最大长度。用后缀数组的时候求出l=lcp(i,len+1),判断l+i是不是等于len,如果等于那么就

2016-05-01 15:53:06

Herumw

我回来了
关注
  • 计算机软件/学生
  • 中国
奖章
  • 持之以恒