Add the first exo1 program.
authorJérôme Benoit <jerome.benoit@piment-noir.org>
Fri, 9 Nov 2018 09:15:00 +0000 (10:15 +0100)
committerJérôme Benoit <jerome.benoit@piment-noir.org>
Fri, 9 Nov 2018 09:15:00 +0000 (10:15 +0100)
Signed-off-by: Jérôme Benoit <jerome.benoit@piment-noir.org>
TP1/exo1/TP1prog1.py [new file with mode: 0755]

diff --git a/TP1/exo1/TP1prog1.py b/TP1/exo1/TP1prog1.py
new file mode 100755 (executable)
index 0000000..f0e5324
--- /dev/null
@@ -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()