-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path2-1-1.py
More file actions
25 lines (21 loc) · 707 Bytes
/
2-1-1.py
File metadata and controls
25 lines (21 loc) · 707 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
from matplotlib import pyplot as plt
from sklearn.datasets import load_iris
import numpy as np
data = load_iris()
features = data['data']
feature_names = data['feature_names']
target = data['target']
target_names = data['target_names']
labels = target_names[target]
pairs = [(0, 1), (0, 2), (0, 3), (1, 2), (1, 3), (2, 3)]
for i, (p0, p1) in enumerate(pairs):
plt.subplot(2, 3, i + 1)
for t, marker, c in zip(range(3), ">ox", "rgb"):
plt.scatter(features[target == t, p0],
features[target == t, p1],
marker = marker, c=c)
plt.xlabel(feature_names[p0])
plt.ylabel(feature_names[p1])
plt.xticks([])
plt.yticks([])
plt.show()