Measuring drift in Python
When measuring drift, the first thing to do is to make sure that your model is writing out logs or results in some way. For the following example, you'll use a dataset in which each prediction was logged so that we have for each prediction the input variables, the prediction, the ground truth, and the absolute differences between prediction and ground truth as an indicator of error.
Logging your model's behavior is an absolute prerequisite if you want to work on drift detection. Let's start with some basic measurements that could help you to detect drift using Python.
A basic intuitive approach to measuring drift
In this section, you will discover an intuitive approach to measuring drift. Here are the steps we'll follow:
- To get started measuring drift on our logged results data, we start by importing the data as a
pandas
DataFrame. This is done in the following code block:
Code block 9-1
import pandas as pd data...