机器学习
我不叫小北
这个作者很懒,什么都没留下…
展开
-
kNN算法
程序引用《机器学习实战》用python实现kNN算法,题中假设把目标分为A类和B类,在前3中统计出与A类最近的点from numpy import *import operatordef createDataSet():group=array([[1.0,1.1],[1.0,1.0],[0,0],[0,0.1]])labels=['A','A','B','B']prin原创 2016-10-19 10:18:24 · 382 阅读 · 0 评论 -
KNN算法实例
《机器学习算法一书中的实战》python 学习总结 中文注释需要 添加# -*- coding:utf-8 -*-# -*- coding:utf-8 -*-from numpy import *import operatordef file2matrix(filename):fr=open(filename)numberOfLines=len(fr.readlin原创 2016-10-19 19:05:26 · 1561 阅读 · 0 评论 -
linux中利用python计算熵
熵反应信息的混乱程度熵的计算公式为p*log(p,2)对每个分类的概率进行求和,值越大反应信息越混乱,用python实现的代码:from math import logdef calcShannonEnt(dataSet): numEntries=len(dataSet) labelCounts={} for featVec in dataSet: currentLabel=f原创 2016-10-30 00:39:26 · 1911 阅读 · 0 评论 -
Pytorch conv2d 关于输入输出尺寸的介绍
本来不是啥比较难的东西,因为没怎么用,又忘记了,放在这儿,做个备忘!!input w*houtput wo*hofilter FPadding Pstride Swo = (w - F + 2*P)/S +1原创 2018-03-05 22:45:55 · 15883 阅读 · 9 评论 -
tensorflow GPU安装
1 下载cuda9.0,安装2 下载cudnn,复制到C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0文件夹下3 conda install tensorflow-GPU安装即可原创 2018-08-24 10:10:49 · 230 阅读 · 0 评论 -
raw格式的图像转为可以查看的png格式
将raw格式的图像转为可以查看的png格式:# coding:utf-8from PIL import ImagerawData = open('Color_74.raw','rb').read()imgSize = (640,480) ###The size of the image# Use the PIL raw decoder to read the data.# the '...原创 2018-08-24 10:15:16 · 4631 阅读 · 0 评论