TypeError: list indications must be integrers or slies, not str error, but I don't know how to solve it, I tried int instead of str, but it didn't work.
//tsne = TSNE(random_state=0, n_iter=300, learning_rate=100)
X_tsne = tsne.fit_transform(X_sub)
plt.figure(figsize=(10, 10))
plt.xlim(X_tsne[:, 0].min(), X_tsne[:, 0].max() + 1)
plt.ylim(X_tsne[:, 1].min(), X_tsne[:, 1].max() + 1)
for i in range(len(X)):
# Use numeric text to draw a scatterplot
plt.text(X_tsne[i, 0], X_tsne[i, 1], str(X.target[i]),
color = colors[X.target[i]],
fontdict={'weight': 'bold', 'size': 9})
plt.xlabel("t-SNE feature 0")
plt.xlabel("t-SNE feature 1")
X.target[i] must be the string.
© 2024 OneMinuteCode. All rights reserved.