From 40ae5ee5d3f8b960020c86b837fb5fc74f7fa714 Mon Sep 17 00:00:00 2001 From: sbosse Date: Tue, 27 Aug 2024 00:15:49 +0200 Subject: [PATCH] Tue 27 Aug 00:14:56 CEST 2024 --- test/test-mlp2.js | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 test/test-mlp2.js diff --git a/test/test-mlp2.js b/test/test-mlp2.js new file mode 100644 index 0000000..6211245 --- /dev/null +++ b/test/test-mlp2.js @@ -0,0 +1,45 @@ +var x = csv.read('test-c45-3-X.csv'), + y = csv.read('test-c45-3-Y.csv'); + +x.shift(); +y.shift(); + +var classes=[ +'H1None', +'H2None', +'H3None', +'H4None', +'H5None', +'H6None', +'H7None', +'H8None', +'H9None', +'NoneNone', +]; + +y=y.map(function (c1) { + return classes.map(function (c2) { + return c1==c2?1:0 + }) +}) + +var model = ml.learn({ + algorithm : ml.ML.MLP, + x : x, + y : y, + normalize:true, + // bipolar:true, + epochs : 20000, + hidden_layers : [4] +}); + +print(toJSON(model).length+' Bytes') + +var targets,samples = csv.read('test-c45-3-S.csv'); +samples.shift(); +targets=ml.stats.utils.column(samples,x[0].length); +samples=ml.stats.utils.select(samples,[0,x[0].length-1]); + +for(var i=0;i