ad61e2d2b6502f1a3d9e3bf3550462967e842c6e
[TP_AA.git] / TP1 / exo1 / iris4.py
1 #!/usr/bin/env python3
2
3 import pylab as pl # permet de remplacer le nom "pylab" par "pl"
4
5 from sklearn.datasets import load_iris # les données iris sont chargées
6 irisData = load_iris()
7
8 X = irisData.data
9 Y = irisData.target
10 x = 0
11 y = 1
12 print(Y == 0)
13 print(X[Y == 0])
14 print(X[Y == 0][:, x])
15 pl.scatter(X[Y == 0][:, x], X[Y == 0][:, y],
16 color="red", label=irisData.target_names[0])
17 pl.scatter(X[Y == 1][:, x], X[Y == 1][:, y],
18 color="green", label=irisData.target_names[1])
19 pl.scatter(X[Y == 2][:, x], X[Y == 2][:, y],
20 color="blue", label=irisData.target_names[2])
21 pl.legend()
22 pl.show()