Skip to main content

testAUC is a library of tools to evaluate the true performance of ML/AI models

Project description

testAUC

Quick start

pip install testAUC

To evaluate the drift between the Validation set to the Test set use:

from testAUC import roc_drift, faux_normal_predictions, dashboard

# Simulate a model, evaluated on a Validation set and a Test set:
y_true_val, y_score_val = faux_normal_predictions(neg_mu=0.3, pos_mu=0.8, seed=2023)
y_true_tst, y_score_tst = faux_normal_predictions(std=0.5, neg_mu=0.4, pos_mu=0.9, seed=2023)

# Calculate Drift between Validation set performance to Test set performance
tpr_drift, fpr_drift, drift, thresholds_val, mean_drift = roc_drift(y_true_val, y_score_val, y_true_tst, y_score_tst)

# All in one Dashboard to evaluate the Validation vs. Test sets performance
dashboard(y_true_val, y_score_val, y_true_tst, y_score_tst)

Demo

Some tools included:

  • roc_drift -> Calculate the ROC drift from validation to test sets
  • colored_roc_curve -> Plot an ROC curve that is color coded by threshold
  • val_tst_colored_roc_curve -> Same colored ROC curve but for both val&tst sets (sharing color limits!)
  • faux_normal_predictions -> A small utility function to create fake model predictions
  • plot_predictions_hist -> Plot a histogram of predictions for the Positive and Negative classes
  • dashboard -> An All-In-One dashboard to evaluate the test performance (currently missing Robustness metric, stay tuned!)

Motivation

The ROC (Receiver operating characteristic) curve is generally used for evaluation of ML/AI model performance in classification tasks. There are a number of pitfalls of using the ROC curve, some of which are outlined in example below

Example 0: Demonstrates how two very different predictions can result in the exact same ROC curve.

Example0

Example 1: Demonstrates the shifting of the operation point, despite the favourable AUC. We show predictions of a (simulated) model on the Validation set and the Test set. The ROC AUC "happens" to be identical. However, if you choose a threshold on the Validation set, aiming for a Sensitivity/Specificity operation point, you would get completely different operation point on the Test set

Example1

Example 2: Demonstrates a measure of robustness to noise. We show two models, Initially it seems that Model 1 is far better, offering ROC AUC above 91% However, evaluating the robustness to uniform noise shows Model 2 is more robust

Example2

Example 3: Demonstrates a measure of DRIFT between the validation set and the test set We show two models, both of them "happen" to have the exact same AUC on the validation and test sets. However, evaluating the DRIFT of the Sensitivity/Specificity operation point reveals that Model 1 is better (although in this extreme case, both models exhibit significant drifts)

Note that at some operation point, Model 2 actually exceeds a drift of -50% from the Sensitivity expected at Validation time, compared to the Sensitivity received at test time - without affecting the total AUC.

Example3

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

testauc-0.0.6.tar.gz (5.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

testauc-0.0.6-py3-none-any.whl (5.9 kB view details)

Uploaded Python 3

File details

Details for the file testauc-0.0.6.tar.gz.

File metadata

  • Download URL: testauc-0.0.6.tar.gz
  • Upload date:
  • Size: 5.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.5

File hashes

Hashes for testauc-0.0.6.tar.gz
Algorithm Hash digest
SHA256 43975b3c1cb54a752cf54c81eee631896183c6ab50809e4f3c70bfecea568e30
MD5 abadc2a76750a04954d09052ec0ba481
BLAKE2b-256 6b239174fb94bf8ffcbcb2c95d7ae75f56b2094a7848d3090e6d5fd27ae75547

See more details on using hashes here.

File details

Details for the file testauc-0.0.6-py3-none-any.whl.

File metadata

  • Download URL: testauc-0.0.6-py3-none-any.whl
  • Upload date:
  • Size: 5.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.5

File hashes

Hashes for testauc-0.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 7c2e51b03d58fa9198d9a685ec8907322a314c2bde3153942dc5de06ae0bead9
MD5 97054f78d09e904b9d51a5b42f24bb07
BLAKE2b-256 c8ae4130bc954f2eda08af3b0434d4ba0f725b9f11f353d5db6b052f4fdd7c41

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page