Statistical-Learning-Method_Code icon indicating copy to clipboard operation
Statistical-Learning-Method_Code copied to clipboard

手写实现李航《统计学习方法》书中全部算法

Results 20 Statistical-Learning-Method_Code issues
Sort by recently updated
recently updated
newest added

``` def cal_groupcenter(group, Xarray): center = np.zeros(Xarray.shape[1]) for i in range(Xarray.shape[1]): #range(4) for n in group: center[i] += Xarray[n][i] #计算当前类中第i个特征的数据之和 center = center / Xarray.shape[0] #计算各个特征的均值 return center ``` **作者您好!十分感谢你开源的机器学习代码,受益良多,想请教一下:在上面的函数中,为什么使用center...

大佬,我在看代码时,没有明白这个M是什么意思,想请教一下大佬,谢谢!

![image](https://user-images.githubusercontent.com/20618808/147385713-1f0fa646-3161-453a-8874-3e1b8f253e0e.png)

挺差的。但是开源精神值得赞赏。

K-means clustering计算兰德系数时 sum_i = np.zeros(3) #定义一个数组,用于保存聚类结果group_dict中每一类的个数 sum_j = np.zeros(3) #定义一个数组,用于保存外部标签y_dict中每一类的个数 应该是 sum_i = np.zeros(k) 否则聚类数目不为3时,代码会报错

拜读完毕,纠正几个小笔误。

曼哈顿距离是不是错了?应该是绝对值的和

#coding=utf-8 #Author:Dodo #Date:2018-11-16 #Email:[email protected] ''' 数据集:Mnist 训练集数量:60000 测试集数量:10000(实际使用:200) ------------------------------ 运行结果:(邻近k数量:25) 向量距离使用算法——欧式距离 正确率:97% 运行时长:308s 向量距离使用算法——曼哈顿距离 正确率:14% 运行时长:246s ''' import numpy as np import time from collections import Counter def loadData(fileName): '''...