attributes.put("gender", "male");
instances.add(new InstanceImpl<AttributesMap>(attributes, "healthy"));
{
TreeBuilder treeBuilder = new TreeBuilder();
Tree tree = treeBuilder.buildPredictiveModel(instances);
attributes = AttributesMap.newHashMap() ;
attributes.put("height",62);
attributes.put("weight", 201);
attributes.put("gender", "female");
Serializable classification = tree.getClassificationByMaxProb(attributes);
if (classification.equals("healthy")) {
System.out.println("They are healthy!");
} else if (classification.equals("underweight")) {
System.out.println("They are underweight!");
} else {
System.out.println("They are overweight!");
}
tree.node.dump(System.out);
}
{
TreeBuilder treeBuilder = new TreeBuilder()
.ignoreAttributeAtNodeProbability(0.7);
RandomForestBuilder randomForestBuilder = new RandomForestBuilder(treeBuilder)
.numTrees(50);
RandomForest randomForest = randomForestBuilder.buildPredictiveModel(instances);