Testing and comparing the models

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.

Getting ready

To execute this recipe, all you need is pandas and scikit-learn. No other prerequisites are necessary.

How to do it…

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 ...

Get Practical Data Analysis Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.