Skip to content

Commit b15d985

Browse files
committed
update hetero test
1 parent c8e24d0 commit b15d985

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

test/classification_hetero.jl

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
### Classification - Heterogeneously typed features (ints, floats, bools, strings)
22

3+
using Base.Test
34
using DecisionTree
45

56
m, n = 10^2, 5;
@@ -11,10 +12,21 @@ labels = string.(tf[inds]);
1112
features = Array{Any}(m, n);
1213
features[:,:] = randn(m, n);
1314
features[:,2] = string.(tf[randperm(m)]);
14-
features[:,3] = round.(Int, features[:,3]);
15+
features[:,3] = round(Int, features[:,3]);
1516
features[:,4] = tf[inds];
1617

17-
build_tree(labels, features)
18-
build_forest(labels, features,2,3)
19-
build_stump(labels, features)
18+
model = build_tree(labels, features);
19+
preds = apply_tree(model, features);
20+
cm = confusion_matrix(labels, preds);
21+
@test cm.accuracy > 0.7
22+
23+
model = build_forest(labels, features,2,3);
24+
preds = apply_forest(model, features);
25+
cm = confusion_matrix(labels, preds);
26+
@test cm.accuracy > 0.7
27+
28+
model, coeffs = build_adaboost_stumps(labels, features, 7);
29+
preds = apply_adaboost_stumps(model, coeffs, features);
30+
cm = confusion_matrix(labels, preds);
31+
@test cm.accuracy > 0.7
2032

0 commit comments

Comments
 (0)