From 3150d4fda754d88c8139b6a8577029830e7d75b8 Mon Sep 17 00:00:00 2001 From: sbosse Date: Tue, 27 Aug 2024 00:15:06 +0200 Subject: [PATCH] Tue 27 Aug 00:14:56 CEST 2024 --- test/test-ann1.js | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 test/test-ann1.js diff --git a/test/test-ann1.js b/test/test-ann1.js new file mode 100644 index 0000000..f1d96f8 --- /dev/null +++ b/test/test-ann1.js @@ -0,0 +1,35 @@ +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}))