22 lines
482 B
JavaScript
22 lines
482 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.ICE,
|
|
x:x,
|
|
y:y,
|
|
eps:0.01
|
|
});
|
|
|
|
var targets,samples = csv.read('test-c45-3-S.csv');
|
|
samples.shift();
|
|
targets=ml.stats.utils.column(samples,x[0].length);
|
|
samples=ml.stats.utils.select(samples,[0,x[0].length-1]);
|
|
|
|
print(toJSON(model).length+' Bytes')
|
|
// print(ml.print(model))
|
|
print(ml.classify(model,samples))
|