代码:
for cnt, x in enumerate(data):
# getting the winner
w = som.winner(x)
# place a marker on the winning position for the sample xx
wx, wy = som.convert_map_to_euclidean(w)
wy = wy * np.sqrt(3) / 2
plt.plot(wx, wy,
markers[t[cnt]-1],
markerfacecolor='None',
markeredgecolor=colors[t[cnt]-1],
markersize=12,
markeredgewidth=2)
xrange = np.arange(weights.shape[0])
yrange = np.arange(weights.shape[1])
plt.xticks(xrange-.5, xrange)
plt.yticks(yrange * np.sqrt(3) / 2, yrange)
在markers[t[cnt]-1]这一行报错,不知道该如何解决。
Traceback (most recent call last):
File "naqu.py", line 67, in <module>
markers[t[cnt]-1],
TypeError: list indices must be integers or slices, not numpy.float64