Skip to content

Latest commit

 

History

History
202 lines (133 loc) · 6.86 KB

quick.rst

File metadata and controls

202 lines (133 loc) · 6.86 KB

Quickstart

What is NannyML?

NannyML detects silent model failure, estimates performance of ML models after deployment before target data become available, and robustly detects data drift potentially responsible for the failure. It can also monitor performance once target data is available.

Installing NannyML

NannyML depends on [LightGBM](https://github.com/microsoft/LightGBM). This might require you to set install additional OS-specific binaries. You can follow the [official installation guide](https://lightgbm.readthedocs.io/en/latest/Installation-Guide.html).

From the shell of your python environment type:

$ pip install nannyml

or

$ conda install -c conda-forge nannyml

or

$ docker -v /local/config/dir/:/config/ run nannyml/nannyml nml run

Contents of the quickstart

This quickstart presents core functionalities of NannyML on an example binary classification model that predicts whether an employee will work from home the next day or not. First, the whole code is shown so you can jump in and experiment right away if you want.

This is followed by a detailed walk-through to help you get familiar with the flow, and explain the details. The synthetic dataset<dataset-synthetic-binary> used contains inputs that are already merged with model predictions and ready to be directly used by NannyML.

All our tutorials<tutorials> are a good place to get detailed guides on main concepts and functionalities. If you want to know what is implemented under the hood -visit how it works<how_it_works>. Finally, if you just look for examples on other datasets or ML problems look through our examples<examples>.

Note

The following example does not use any timestamps<Timestamp>. These are optional but have an impact on the way data is chunked and results are plotted. You can read more about them in the data requirements<data_requirements_columns_timestamp>.

Just the code

Walkthrough

We start by loading the synthetic dataset included in the library. This synthetic dataset contains inputs and predictions of a binary classification model that predicts whether an employee will work from home the next workday or not.

The probability of the employee working from home is included in the y_pred_proba column, while the prediction is in y_pred column. The model inputs are distance_from_office, salary_range, gas_price_per_litre, public_transportation_cost, wfh_prev_workday, workday and tenure. identifier is the Identifier column and timestamp is the Timestamp column.

The data are split into a reference period<data-drift-periods-reference> and an analysis period<data-drift-periods-analysis>. NannyML uses the reference period to establish a baseline for expected model performance. The analysis period is where we estimate or monitor performance, as well as detect data drift.

For more information about periods check data-drift-periods. A key thing to remember is that the analysis period doesn't need to contain the Target data.

Let's load and preview the data:

We need to make a choice about the way we will split our data into Data Chunks<Data Chunk>.

Estimating Performance without Targets

NannyML can estimate the performance on a machine learning model in production without access to its Target. For more details on how to use performance estimation see our tutorial on performance estimation<performance-estimation>, while for more details on how the algorithm behind it works see Confidence-based Performance Estimation (CBPE)<performance-estimation-deep-dive>.

image

The results indicate that the model's performance is likely to be negatively impacted from the second half of 2019 onwards.

Detecting Data Drift

NannyML allows for further investigation into potential performance issues with its data drift detection functionality. See data-drift for more details.

image

image

image

image

image

image

image

When there are a lot of drifted features, NannyML can also rank them by the number of alerts they have raised:

More complex data drift cases can get detected by Data Reconstruction with PCA. For more information see Data Reconstruction with PCA<data-reconstruction-pca>.

image

Insights

With NannyML we were able to estimate performance in the absence of ground truth. The estimation has shown potential drop in ROC AUC in the second half of the analysis period. Univariate and multivariate data drift detection algorithms have identified data drift.

Putting everything together, we see that 4 features exhibit data drift from late 2019 onwards. They are distance_from_office, salary_range, public_transportation_cost, wfh_prev_workday. This drift is responsible for the potential negative impact in performance that we have observed in this time period.

What next

This could be further investigated by analyzing changes of distributions of the input variables. Check tutorials<tutorials> on data drift<data-drift> to find out how to plot distributions with NannyML.

You can now try using NannyML on your own data. Our tutorials are a good place to find out what to do for this.