if (attributeNames.size() == 0) {
return majorityValue(ds);
}
String chosenAttribute = chooseAttribute(ds, attributeNames);
DecisionTree tree = new DecisionTree(chosenAttribute);
ConstantDecisonTree m = majorityValue(ds);
List<String> values = ds.getPossibleAttributeValues(chosenAttribute);
for (String v : values) {
DataSet filtered = ds.matchingDataSet(chosenAttribute, v);
List<String> newAttribs = Util.removeFrom(attributeNames,
chosenAttribute);
DecisionTree subTree = decisionTreeLearning(filtered, newAttribs, m);
tree.addNode(v, subTree);
}
return tree;