From 2e68b3136022be150532a96bd610e9d2bd9d396f Mon Sep 17 00:00:00 2001 From: sbosse Date: Tue, 27 Aug 2024 00:15:27 +0200 Subject: [PATCH] Tue 27 Aug 00:14:56 CEST 2024 --- test/test-c45-2.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 test/test-c45-2.js diff --git a/test/test-c45-2.js b/test/test-c45-2.js new file mode 100644 index 0000000..7e94c10 --- /dev/null +++ b/test/test-c45-2.js @@ -0,0 +1,19 @@ +var x = [[0, 0, 0], [0, 1, 1], [1, 1, 0], [2, 2, 2], [1, 2, 2], [2, 1, 2]]; +var y = ['A', 'A', 'B', 'B', 'C', 'C']; +print(x) +print(y) +var model = ml.learn({ + algorithm:ml.ML.C45, + x:x, + y:y, +}); + +var test_data =[[0, 1.2, 0], + [2.1, 2, 3], + [2.1,1.1,2.0]]; + +print(ml.print(model)) +print(ml.classify(model,test_data)) +print(ml.classify(model,[0,1,0])) +print(ml.classify(model,[1,2,3])) +print(ml.classify(model,[2,1,3]))