We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 55e4b80 commit ce10b58Copy full SHA for ce10b58
ch02/stump.py
@@ -7,8 +7,8 @@
7
8
from sklearn.datasets import load_iris
9
data = load_iris()
10
-features = data['data']
11
-labels = data['target_names'][data['target']]
+features = data.data
+labels = data.target_names[data.target]
12
13
14
is_setosa = (labels == 'setosa')
@@ -41,5 +41,5 @@
41
best_acc = acc
42
best_fi = fi
43
best_t = t
44
-print('Best threshold is {0} on feature {1}, which achieves accuracy of {2:.1%}.'.format(
45
- best_t, best_fi, best_acc))
+print('Best threshold is {0} on feature {1} ({2}), which achieves accuracy of {3:.1%}.'.format(
+ best_t, best_fi, data.feature_names[best_fi], best_acc))
0 commit comments