Tue 27 Aug 00:14:56 CEST 2024

This commit is contained in:
sbosse 2024-08-27 00:16:09 +02:00
parent cc3d7f1500
commit 76067fc3d3

29
test/test-mlp1.js Normal file
View File

@ -0,0 +1,29 @@
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 model = ml.learner({
algorithm : ml.ML.MLP,
x : x,
y : y,
hidden_layers : [4,4,5]
});
var result = ml.train(model,{
epochs : 20000,
})
print (result)
print(toJSON(model).length+' Bytes')
a = [[1, 1, 0, 0, 0, 0],
[0, 0, 0, 1, 1, 0],
[1, 1, 1, 1, 1, 0]];
print(ml.classify(model,a));