We implement a decision tree as a recursive function:
tree CreateDecisionTree(data, attributes, target_attr, fitness_func)
best_attribute = feature_select(attributes)
tree = {best_attribute};
for val in get_values(data, best)
subtree = CreateDecisionTree(
get_examples(data, best, val),
attributes other than best,
target_attr,
fitness, func)
tree[best][val] = subtree;
return tree
tree CreateDecisionTree(data, attributes, target_attr, fitness_func)
best_attribute = feature_select(attributes)
tree = {best_attribute};
for val in get_values(data, best)
subtree = CreateDecisionTree(
get_examples(data, best, val),
attributes other than best,
target_attr,
fitness, func)
tree[best][val] = subtree;
return tree
No comments:
Post a Comment