摘要: #include #include #include #include #include #include #include class double_conv:public torch::nn::Module { public: torch::nn::Conv2d conv1,conv2; torch::nn::BatchNorm bn1,bn2; ... 阅读全文
posted @ 2018-10-12 15:19 semen 阅读(1561) 评论(1) 推荐(0) 编辑
摘要: trie树代码 hash代码 trie树查找时间是O(L)L是字符串长度,而hash是O(LL),LL是关键字对应哈希地址链表长度,都和数据的大小无关,查找都很高效 阅读全文
posted @ 2017-07-17 17:26 semen 阅读(1403) 评论(0) 推荐(0) 编辑
摘要: 上面代码只需要放在一个just_one_CNN函数里面就能运行。 可以任意拓展网络的层数,只需更新相应的参数就可以 对下面两张rgb图片能够正确识别,但是要进行处理,要将图片转为灰度图,分割成大小为28x28的图片,在展开成两行向量 阅读全文
posted @ 2017-07-01 23:30 semen 阅读(348) 评论(0) 推荐(0) 编辑
摘要: 先说一个小例子: A,B两个箱子中有白球和其他颜色的球共有N个,从两个箱子中抽取到白球的概率分布为pa和pb,从每个箱子中个抽取十次,然后放回,进行五次实验,统计白球出现的次数 可以很简单的估计出pa和pb,pa=A中抽取到白色次数/A中抽取的次数,同理,pa也一样 我们也可以用极大似然算出是上面的 阅读全文
posted @ 2017-06-25 21:13 semen 阅读(234) 评论(0) 推荐(0) 编辑
摘要: #pythonfrom numpy import * def loadData(filename): data=[] for line in open(filename).readlines(): ft=line.strip().split("\t") th=map(float,ft) data.append(th) ret... 阅读全文
posted @ 2017-06-14 23:28 semen 阅读(186) 评论(0) 推荐(0) 编辑
摘要: from numpy import * import matplotlib.pyplot as plt def loadData(filename): data=[] for line in open(filename).readlines(): linth=line.strip().split("\t") dataline=map(float,l... 阅读全文
posted @ 2017-06-13 22:53 semen 阅读(284) 评论(1) 推荐(0) 编辑
摘要: #coding:utf-8 from numpy import * import matplotlib import matplotlib.pyplot as plt def loadData(filename): fr=open(filename) dataset=[] datalabel=[] for line in fr.readlines(): ... 阅读全文
posted @ 2017-06-10 19:05 semen 阅读(265) 评论(0) 推荐(0) 编辑
摘要: #coding:utf-8 from numpy import * def loaddata(): datamat=[] label=[] fr=open("testSet.txt") for line in fr.readlines(): arr=line.strip().split() datamat.append([1.0,f... 阅读全文
posted @ 2017-06-08 22:04 semen 阅读(257) 评论(0) 推荐(0) 编辑
摘要: #coding:utf-8 from numpy import * import re def createlist(lst):#将所有文本放入一个列表中 listt=set([]) for line in lst: listt=listt|set(line) return list(listt) def word2vec(List,inputset):#... 阅读全文
posted @ 2017-06-08 15:12 semen 阅读(327) 评论(0) 推荐(0) 编辑
摘要: #coding:utf-8 from numpy import * from math import * import operator def file2matrix(filename): fr=open(filename) lines=fr.readlines() lenth=len(lines) rematrix=zeros((lenth,7)) l... 阅读全文
posted @ 2017-06-07 21:03 semen 阅读(346) 评论(0) 推荐(0) 编辑