EnsembleSpec<TreeSpec> ensembleSpec = new EnsembleSpec<TreeSpec>( modelSchema );
ensembleSpec.setSelectionStrategy( new MajorityVote() );
{
TreeSpec treeSpec = new TreeSpec( modelSchema );
Tree tree = new Tree( "1" );
tree.addPredicate( "1", "2", new LessOrEqualThanPredicate( "var0", 0.5d ) );
tree.addPredicate( "2", "4", new LessOrEqualThanPredicate( "var2", 0.5d ), "1" );
tree.addPredicate( "2", "5", new GreaterThanPredicate( "var2", 0.5d ), "0" );
tree.addPredicate( "1", "3", new GreaterThanPredicate( "var0", 0.5d ) );
tree.addPredicate( "3", "6", new LessOrEqualThanPredicate( "var1", 0.5d ), "0" );
tree.addPredicate( "3", "7", new GreaterThanPredicate( "var1", 0.5d ), "1" );
treeSpec.setTree( tree );
ensembleSpec.addModelSpec( treeSpec );
}
{
TreeSpec treeSpec = new TreeSpec( modelSchema );
Tree tree = new Tree( "1" );
tree.addPredicate( "1", "2", new LessOrEqualThanPredicate( "var1", 0.5d ), "1" );
tree.addPredicate( "1", "3", new GreaterThanPredicate( "var1", 0.5d ), "0" );
treeSpec.setTree( tree );
ensembleSpec.addModelSpec( treeSpec );
}
{
TreeSpec treeSpec = new TreeSpec( modelSchema );
Tree tree = new Tree( "1" );
tree.addPredicate( "1", "2", new LessOrEqualThanPredicate( "var0", 0.5d ), "1" );
tree.addPredicate( "1", "3", new GreaterThanPredicate( "var0", 0.5d ), "0" );
treeSpec.setTree( tree );
ensembleSpec.addModelSpec( treeSpec );
}
String inputData = "randomforest.tsv";