From: Jérôme Benoit Date: Fri, 9 Nov 2018 09:15:00 +0000 (+0100) Subject: Add the first exo1 program. X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=ecf194063c271e1d4f67a7de98c2d60e628855c1;p=TP_AA.git Add the first exo1 program. Signed-off-by: Jérôme Benoit --- diff --git a/TP1/exo1/TP1prog1.py b/TP1/exo1/TP1prog1.py new file mode 100755 index 0000000..f0e5324 --- /dev/null +++ b/TP1/exo1/TP1prog1.py @@ -0,0 +1,25 @@ +#!/usr/bin/env python3 + +# -*- coding: utf-8 -*- +import pylab as pl + +from sklearn.datasets import load_iris +irisData = load_iris() + +X = irisData.data +Y = irisData.target + +x = 0 +y = 1 + +colors = ["red", "green", "blue"] + +for i in range(3): + pl.scatter(X[Y == i][:, x], X[Y == i][:, y], color=colors[i], + label=irisData.target_names[i]) + +pl.legend() +pl.xlabel(irisData.feature_names[x]) +pl.ylabel(irisData.feature_names[y]) +pl.title(u"Données Iris - dimension des sépales uniquement") +pl.show()