20 lines
354 B
JavaScript
20 lines
354 B
JavaScript
|
var x = csv.read('test-c45-3-X.csv'),
|
||
|
y = csv.read('test-c45-3-Y.csv');
|
||
|
|
||
|
x.shift(); // remove header
|
||
|
y.shift();
|
||
|
// print(y)
|
||
|
var model = ml.learn({
|
||
|
algorithm:ml.ML.C45,
|
||
|
x:x,
|
||
|
y:y,
|
||
|
});
|
||
|
|
||
|
var samples = csv.read('test-c45-3-S.csv');
|
||
|
samples.shift();
|
||
|
|
||
|
print(toJSON(model).length+' Bytes')
|
||
|
// print(ml.print(model))
|
||
|
|
||
|
print(ml.classify(model,samples))
|