Python
孙俏俏
这个作者很懒,什么都没留下…
展开
-
ValueError: could not convert string to float:
将读入的txt文件中的矩阵由-0.017612,14.053064,-1.395634,4.662541, -0.752157,6.538620,-1.322371,7.152853,形式改为-0.017612 14.053064-1.395634 4.662541 -0.752157 6.538620-1.322371 7.152853...原创 2019-05-08 10:49:47 · 2622 阅读 · 1 评论 -
RuntimeWarning: overflow encountered in exp
将def sigmoid(inX): from numpy import exp return 1.0/(1+exp(-inX))改为def sigmoid(inX): from numpy import exp #return 1.0/(1+exp(-inX)) #优化 if inX>=0: return 1.0/(...转载 2019-05-08 19:21:17 · 7749 阅读 · 3 评论 -
TypeError: 'range' object doesn't support item deletion
del(dataIndex[randIndex])python3.x , 出现错误 'range' object doesn't support item deletion原因:python3.x range返回的是range对象,不返回数组对象解决方法:把dataIndex=range(m)改为dataIndex=list(range(m))...转载 2019-05-07 14:27:18 · 766 阅读 · 0 评论 -
TypeError: 'numpy.float64' object cannot be in
weights=weights+alpha*error*dataMatrix[randIndex] 改为for k in range(n): weights[k] += alpha*error*dataMatrix[randIndex][k]转载 2019-05-07 14:29:39 · 493 阅读 · 0 评论 -
AttributeError: 'numpy.ndarray' object has no attribute 'getA'
解决方法:直接删除.getA()转载 2019-05-07 14:32:34 · 5264 阅读 · 2 评论 -
AttributeError: 'list' object has no attribute 'shape'
将 n1=dataMat1.shape[0]换成 n1=len(dataMat1)原创 2019-05-07 20:16:14 · 3988 阅读 · 1 评论