jam/test/test-ann1.js

36 lines
430 B
JavaScript

var x = [
[0,0],
[0,1],
[1,0],
[1,1]
]
var y = [
0,
1,
1,
0
]
var model = ml.train({
algorithm:ml.ML.ANN,
x:x,
y:y,
equal:true,
iterations:10000,
error:0.1,
layers:[2,1]
});
var samples = [
[0.1,-0.2],
[0.1,1.2],
[0.8,0.1],
[0.9,1.1]
]
print(ml.predict(model,x))
print(ml.predict(model,samples))
//print(ml.test(model,{x:x,y:y}))
//print(ml.test(model,{x:test,y:y}))