Use X and y in plot_lle_digits.py
rather than digits.data and digits.target
@@ -48,14 +48,14 @@ def plot_embedding(X, title=None):
plt.figure()
ax = plt.subplot(111)
for i in range(X.shape[0]):
- plt.text(X[i, 0], X[i, 1], str(digits.target[i]),
+ plt.text(X[i, 0], X[i, 1], str(y[i]),
color=plt.cm.Set1(y[i] / 10.),
fontdict={'weight': 'bold', 'size': 9})
if hasattr(offsetbox, 'AnnotationBbox'):
# only print thumbnails with matplotlib > 1.0
shown_images = np.array([[1., 1.]]) # just something big
- for i in range(digits.data.shape[0]):
+ for i in range(X.shape[0]):
dist = np.sum((X[i] - shown_images) ** 2, 1)
if np.min(dist) < 4e-3:
# don't show points that are too close
