Skip to content

Commit ce10b58

Browse files
committed
ENH Better output. Simpler code.
1 parent 55e4b80 commit ce10b58

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

ch02/stump.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77

88
from sklearn.datasets import load_iris
99
data = load_iris()
10-
features = data['data']
11-
labels = data['target_names'][data['target']]
10+
features = data.data
11+
labels = data.target_names[data.target]
1212

1313

1414
is_setosa = (labels == 'setosa')
@@ -41,5 +41,5 @@
4141
best_acc = acc
4242
best_fi = fi
4343
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))
44+
print('Best threshold is {0} on feature {1} ({2}), which achieves accuracy of {3:.1%}.'.format(
45+
best_t, best_fi, data.feature_names[best_fi], best_acc))

0 commit comments

Comments
 (0)