erlang-decision-tree/app/decision-tree/engine.erl
2019-05-09 15:58:45 +01:00

31 lines
1.0 KiB
Erlang

-module(engine).
-compile([export_all]).
% Decision Tree
%
% +----+
% +---> OK |
% | +----+
% |
% +----------| +----+
% | DO MED 1 +---> KO |
% +----------+ +----+ +----+
% | +---> OK |
% | +---------------| +----+
% +---> DO MED 2 +
% +---------------| +----+
% +---> KO |
% +----+
% Each edge can be calculated from the table
doAll() ->
T = dec_tree:start(),
T ! {create_node, 'DO MED1', 0, none},
T ! {create_node, 'MED1 OK', 0.980, 'DO MED1'},
T ! {create_node, 'MED1 KO', 0.225, 'DO MED1'},
T ! {create_node, 'DO MED2', 0.356, 'DO MED1'},
T ! {create_node, 'MED 2 OK', 0.62, 'DO MED2'},
T ! {create_node, 'MED 2 KO', 0.38, 'DO MED2'},
T ! {solve}.