Skip to content

Commit c8e24d0

Browse files
committed
update tests
1 parent 52238bf commit c8e24d0

File tree

3 files changed

+29
-1
lines changed

3 files changed

+29
-1
lines changed

test/classification_hetero.jl

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
### Classification - Heterogeneously typed features (ints, floats, bools, strings)
2+
3+
using DecisionTree
4+
5+
m, n = 10^2, 5;
6+
7+
tf = [trues(Int(m/2)) falses(Int(m/2))];
8+
inds = randperm(m);
9+
labels = string.(tf[inds]);
10+
11+
features = Array{Any}(m, n);
12+
features[:,:] = randn(m, n);
13+
features[:,2] = string.(tf[randperm(m)]);
14+
features[:,3] = round.(Int, features[:,3]);
15+
features[:,4] = tf[inds];
16+
17+
build_tree(labels, features)
18+
build_forest(labels, features,2,3)
19+
build_stump(labels, features)
20+

test/misc.jl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
### Promote Leaf to Node
2+
3+
leaf = Leaf(0, [0])
4+
node = Node(1, 1, leaf, leaf)
5+
6+
[leaf, node]
7+
[node, leaf]
8+

test/runtests.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
using Base.Test
22
using DecisionTree
33

4-
tests = ["classification_rand.jl", "regression_rand.jl",
4+
tests = ["classification_rand.jl", "regression_rand.jl", "classification_hetero.jl", "misc.jl",
55
"classification_scikitlearn.jl", "regression_scikitlearn.jl"]
66

77
println("Running tests...")

0 commit comments

Comments
 (0)