Professional Documents
Culture Documents
TranMinhTu1 bt2 2
TranMinhTu1 bt2 2
(150, 5)
sepal length (cm) sepal width (cm) petal length (cm) petal width
(cm) \
0 5.1 3.5 1.4
0.2
1 4.9 3.0 1.4
0.2
2 4.7 3.2 1.3
0.2
target
0 0
1 0
2 0
labels = iris.target_names
feature_names = iris.feature_names
print('Number of Classes: {}'.format(len(labels)))
print(labels)
print('Number of Features: {}'.format(len(feature_names)))
print(feature_names)
Number of Classes: 3
['setosa' 'versicolor' 'virginica']
Number of Features: 4
['sepal length (cm)', 'sepal width (cm)', 'petal length (cm)', 'petal
width (cm)']
(105, 4) (105,)
(45, 4) (45,)
sepal length (cm) sepal width (cm) petal length (cm) petal
width (cm)
60 5.0 2.0 3.5
1.0
116 6.5 3.0 5.5
1.8
144 6.7 3.3 5.7
2.5
sepal length (cm) sepal width (cm) petal length (cm) petal
width (cm)
114 5.8 2.8 5.1
2.4
62 6.0 2.2 4.0
1.0
33 5.5 4.2 1.4
0.2
DecisionTreeClassifier(max_depth=2, random_state=0)
[[16 0 0]
[ 0 13 5]
[ 0 0 11]]