It’s time to check how well the classifier did. You can measure the performance of classifiers in various ways. You can find the accuracy by calculating the percentage correctly classified. For numeric data, you can use an error function, such as the mean squared error (MSE) which finds the average of the squares of the errors or difference between the predicted and actual values. For each problem, you need to decide how to test your algorithm.
How well has your decision tree performed? Try it on the four coordinates:
|||data = [[0, 0, False], [1, 0, False], [0, 1, True], [1, 1, True]]|
|||label = ['x', 'y', 'out']|
|||tree = create_tree(data, label)|
You get this rule:
|||if y = 0 then False. ...|