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)
y_true_tst, y_score_tst = faux_normal_predictions(neg_mu=0.4, pos_mu=0.9)

# 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.4.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.4-py3-none-any.whl (5.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: testauc-0.0.4.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.4.tar.gz
Algorithm Hash digest
SHA256 6111bdd5acd04c1f82191d1346bf1caf8438cadd90bef397c21623969fce70d6
MD5 37a970633899a62873fdca7c625d87fd
BLAKE2b-256 fb17c0359af76a32fb2ffdb8f3e02b70fb84e389f7e15cf08fe330328b4c2820

See more details on using hashes here.

File details

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

File metadata

  • Download URL: testauc-0.0.4-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.4-py3-none-any.whl
Algorithm Hash digest
SHA256 9aeb8085e8fb5781825f866aeaa56811e2430c802fb06142a24f34f760e36812
MD5 83b69af5158ab4e2fa00769cd83bbecd
BLAKE2b-256 71bce3cdb5c27757ddd00f0eaacc354d39bcc54f3e31cd24e236e43400cbb86c

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