Add the first exo1 program.
[TP_AA.git] / TP1 / exo1 / TP1prog1.py
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()