Building statistical models without understanding their effectiveness is a pointless exercise as it gives no indication of whether your model works or not. It also makes it impossible to compare between models in order to choose which one performs better.
In this recipe, we will see how to understand whether your models work well.
To execute this recipe, all you need is pandas
and scikit-learn. No other prerequisites are necessary.
pandas
makes it extremely easy to calculate a suite of test statistics of the performance of your model. We will be using the following code to assess the power of our models (the helper.py
file at the root of the Codes
folder):
import sklearn.metrics as mt def printModelSummary(actual, predicted): ''' Method to print out model summaries ''' print('Overall accuracy of the model is {0:.2f} percent'\ .format( (actual == predicted).sum() / \ len(actual) *...