我想获得784维度的原始数字直方图。 这是我的代码:
Traceback (most recent call last):
File "HW3.py", line 56, in <module>
distances = computeDistances(datasets.DigitData.X)
File "HW3.py", line 39, in computeDistances
dist.append( exampleDistance(data[n],data[m]) / sqrt(D))
File "HW3.py", line 23, in exampleDistance
for i,v1 in x1.iteritems():
AttributeError: 'numpy.ndarray' object has no attribute 'iteritems'
但是出了点问题:
class DigitData:
Xall,Yall = loadDigitData('data/1vs2.all')
N,D = Xall.shape
N0 = int(float(N) * 0.5)
X = Xall[0:N0,:]
Y = Yall[0:N0]
Xte = Xall[N0:,:]
Yte = Yall[N0:]
此外,这里是数字数据集:
--my_column--
"{431}"
"{431,33}"
"{431,60}"
"{431,28}"
"{431,1}"
"{431,226}"
"{431,38}"
"{431,226,229}"
"{431,226,227}"
"{431,226,235}"
"{431,226,239}"
"{431,226,241}"
然后我该如何解决?作为一个蟒蛇初学者,我对绘图非常困惑。