Example: Testing & Predictions


To test our model let's see how we perform on the test set we created:

print(tree.predict(creditScoreAndIncomeTest))

This prints:

['Yes' 'No']

which is the same as our approvedTest variable, so it looks like our model is working! In reality, we'd want more test and we would need to calculate how many of those failed and how many of those passed.

To run our model on new data, we can use the same predict method:

print(tree.predict([[300,50000]]))

results matching ""

    No results matching ""