jam/test/test-slp1.js

28 lines
537 B
JavaScript
Raw Normal View History

2024-08-27 00:15:51 +02:00
var x = [[1,1,1,0,0,0],
[1,0,1,0,0,0],
[1,1,1,0,0,0],
[0,0,1,1,1,0],
[0,0,1,1,0,0],
[0,0,1,1,1,0]];
var y = [[1, 0],
[1, 0],
[1, 0],
[0, 1],
[0, 1],
[0, 1]];
var t0=time();
var model = ml.learn({
algorithm : ml.ML.SLP,
x : x,
y : y,
epochs : 20000,
});
var t1=time()
print(toJSON(model).length+' Bytes')
print((t1-t0)+'ms');
a = [[1, 1, 0, 0, 0, 0],
[0, 0, 0, 1, 1, 0],
[1, 1, 1, 1, 1, 0]];
print(ml.classify(model,a));