From ecf194063c271e1d4f67a7de98c2d60e628855c1 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Fri, 9 Nov 2018 10:15:00 +0100 Subject: [PATCH] Add the first exo1 program. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- TP1/exo1/TP1prog1.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100755 TP1/exo1/TP1prog1.py 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() -- 2.34.1