From 76067fc3d3ed8afd6b19858b00bd12ce8f2e731a Mon Sep 17 00:00:00 2001 From: sbosse Date: Tue, 27 Aug 2024 00:16:09 +0200 Subject: [PATCH] Tue 27 Aug 00:14:56 CEST 2024 --- test/test-mlp1.js | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 test/test-mlp1.js diff --git a/test/test-mlp1.js b/test/test-mlp1.js new file mode 100644 index 0000000..892283b --- /dev/null +++ b/test/test-mlp1.js @@ -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));