Share Brilliantly
decision trees
let tr = await import('/lib/machine-learning/tree/v1.0.0/binary.mjs');
let data = [
{popcorn:true, soda:true, age:7,ice:false},
{popcorn:true, soda:false, age:12,ice:false},
{popcorn:false, soda:true, age:18,ice:true},
{popcorn:false, soda:true, age:35,ice:true},
{popcorn:true, soda:true, age:38,ice:true},
{popcorn:true, soda:false, age:50,ice:false},
{popcorn:false, soda:false, age:83,ice:false},
];
let tree = tr.learn(tr.gini,'ice', data);
let classify = tr.classify({
popcorn:true, soda:true, age:15
}, tree);