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

Uploaded Python 3

File details

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

File metadata

  • Download URL: testauc-0.0.5.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.5.tar.gz
Algorithm Hash digest
SHA256 3bbd1b5cc604bdf190fa5de7e556b78eca4b24872063e9ebf6f6f4baaa64ad42
MD5 001276078d09b1dde82f46935147da9c
BLAKE2b-256 f8fbf75c9bc17aeedbed9e0cc7bc3d15123a7419b3243c41b122e5b18e0566d1

See more details on using hashes here.

File details

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

File metadata

  • Download URL: testauc-0.0.5-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.5-py3-none-any.whl
Algorithm Hash digest
SHA256 42340da8da39f6aa22c7d1d0d9b2cad1629401f6ed8843f40ba42904143f6033
MD5 790b62dd052dcecf3f044b81aea8bef9
BLAKE2b-256 e900205d3bcc9676a4e24f3331516987fca9ae6e45a702dadb8c06947c09d71f

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