Unsupervised Learning in Python
Benjamin Wilson
Director of Research at lateral.io
samples
print(samples)
[[ 5. 3.3 1.4 0.2]
[ 5. 3.5 1.3 0.3]
[ 4.9 2.4 3.3 1. ]
[ 6.3 2.8 5.1 1.5]
...
[ 4.9 3.1 1.5 0.1]]
species
giving species of labels as number (0, 1, or 2)print(species)
[0, 0, 1, 2, ..., 0]
import matplotlib.pyplot as plt from sklearn.manifold import TSNE model = TSNE(learning_rate=100)
transformed = model.fit_transform(samples) xs = transformed[:,0] ys = transformed[:,1] plt.scatter(xs, ys, c=species) plt.show()
fit_transform()
methodfit()
or transform()
methods
Unsupervised Learning in Python