File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change 1
1
function load_data (name)
2
+ datasets = [" iris" , " adult" , " digits" ]
2
3
data_path = joinpath (dirname (pathof (DecisionTree)), " .." , " test/data/" )
3
4
4
5
if name == " digits"
@@ -10,20 +11,24 @@ function load_data(name)
10
11
data = hcat (data... )
11
12
Y = Int .(data[1 , 1 : end ]) .+ 1
12
13
X = convert (Matrix, transpose (data[2 : end , 1 : end ]))
13
- return X, Y
14
+ return X, Y
14
15
end
15
16
16
17
if name == " iris"
17
18
iris = DelimitedFiles. readdlm (joinpath (data_path, " iris.csv" ), ' ,' )
18
19
X = iris[:, 1 : 4 ]
19
20
Y = iris[:, 5 ]
20
- return X, Y
21
+ return X, Y
21
22
end
22
23
23
24
if name == " adult"
24
25
adult = DelimitedFiles. readdlm (joinpath (data_path, " adult.csv" ), ' ,' );
25
26
X = adult[:, 1 : 14 ];
26
27
Y = adult[:, 15 ];
27
- return X, Y
28
+ return X, Y
29
+ end
30
+
31
+ if ! (name in datasets)
32
+ throw (" Available datasets are $(join (datasets," , " )) " )
28
33
end
29
34
end
You can’t perform that action at this time.
0 commit comments