X-Git-Url: https://git.piment-noir.org/?p=TP_AA.git;a=blobdiff_plain;f=TP1%2Fexo1%2Firis4.py;fp=TP1%2Fexo1%2Firis4.py;h=66465617c2dc63bf4f5e51471b3d7a1dea994422;hp=0000000000000000000000000000000000000000;hb=23e029749c95c52a7b221b41d6d82976b9f9d7e3;hpb=9a5ce7696513532fbb847cfd713a681ea380fef2 diff --git a/TP1/exo1/iris4.py b/TP1/exo1/iris4.py new file mode 100755 index 0000000..6646561 --- /dev/null +++ b/TP1/exo1/iris4.py @@ -0,0 +1,22 @@ +#!/usr/bin/env python3 + +import pylab as pl # permet de remplacer le nom "pylab" par "pl" + +from sklearn.datasets import load_iris # les données iris sont chargées +irisData = load_iris() + +X = irisData.data +Y = irisData.target +x = 0 +y = 1 +Y == 0 +X[Y == 0] +X[Y == 0][:, x] +pl.scatter(X[Y == 0][:, x], X[Y == 0][:, y], + color="red", label=irisData.target_names[0]) +pl.scatter(X[Y == 1][:, x], X[Y == 1][:, y], + color="green", label=irisData.target_names[1]) +pl.scatter(X[Y == 2][:, x], X[Y == 2][:, y], + color="blue", label=irisData.target_names[2]) +pl.legend() +pl.show()