Tue 27 Aug 00:14:56 CEST 2024
This commit is contained in:
parent
cc3d7f1500
commit
76067fc3d3
29
test/test-mlp1.js
Normal file
29
test/test-mlp1.js
Normal 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));
|
Loading…
Reference in New Issue
Block a user