]> gitweb.factorcode.org Git - factor.git/blob - extra/machine-learning/decision-trees/decision-trees-tests.factor
Switch to https urls
[factor.git] / extra / machine-learning / decision-trees / decision-trees-tests.factor
1 ! Copyright (C) 2018 Björn Lindqvist
2 ! See https://factorcode.org/license.txt for BSD license
3 USING: formatting kernel machine-learning.data-sets
4 machine-learning.decision-trees sequences tools.test ;
5 IN: machine-learning.decision-trees.tests
6
7 : monks-gains ( name -- seq )
8     load-monks 6 <iota> [ average-gain "%.3f" sprintf ] with map ;
9
10 {
11     { "0.075" "0.006" "0.005" "0.026" "0.287" "0.001" }
12     { "0.004" "0.002" "0.001" "0.016" "0.017" "0.006" }
13     { "0.007" "0.294" "0.001" "0.003" "0.256" "0.007" }
14 } [
15     "monks-1.train" monks-gains
16     "monks-2.train" monks-gains
17     "monks-3.train" monks-gains
18 ] unit-test
19
20 { 4 } [
21     "monks-1.train" load-monks highest-gain-index
22 ] unit-test