Skip to main content

Compute uncertainties on classification model metrics.

Project description

MacOS build Linux build Windows build Documentation License PyPi

Model-Metric-Uncertainty (MMU) is a library for the evaluation of model performance and estimation of the uncertainty on these metrics.

Documentation

MMU is currently in alpha state and not yet ready for production usage

Functionality

On a high level MMU provides two types of functionality:

  • Metrics - functions to compute confusion matrix(ces) and binary classification metrics over classifier scores or predictions.

  • Uncertainty estimators - functionality to compute the joint uncertainty over classification metrics.

We currently focus on binary classification models but aim to include support for other types of models and their metrics in the future.

Confusion Matrix & Metrics

Metrics consist mainly of high-performance functions to compute the confusion matrix and metrics over a single test set, multiple classification thresholds and or multiple runs.

The binary_metrics functions compute the 10 most commonly used metrics:

  • Negative precision aka Negative Predictive Value (NPV)

  • Positive recision aka Positive Predictive Value (PPV)

  • Negative recall aka True Negative Rate (TNR) aka Specificity

  • Positive recall aka True Positive Rate (TPR) aka Sensitivity

  • Negative f1 score

  • Positive f1 score

  • False Positive Rate (FPR)

  • False Negative Rate (FNR)

  • Accuracy

  • Mathew’s Correlation Coefficient (MCC)

Uncertainty estimators

MMU provides two methods for modelling the joint uncertainty on precision and recall: Multinomial uncertainty and Bivariate-Normal.

The Multinomial approach estimates the uncertainty by computing the profile log-likelihoods scores for a grid around the precision and recall. The scores are chi2 distributed with 2 degrees of freedom which can be used to determine the confidence interval.

The Bivariate-Normal approach models the statistical uncertainty over the linearly propagated errors of the confusion matrix and the analytical covariance matrix. The resulting joint uncertainty is elliptical in nature.

Installation

mmu can be installed from PyPi.

pip install mmu

We provide wheels for:

  • MacOS [x86, ARM]

  • Linux

  • Windows

Installing the package from source requires a C++ compiler with support for C++14. If you have a compiler available it is advised to install without the wheel as this enables architecture specific optimisations.

pip install mmu --no-binary mmu

Other build options exist, see the Installation section of the docs.

Usage

import mmu

# Create some example data
scores, y, yhat = mmu.generate_data(n_samples=1000)

# Compute the joint uncertainty on precision and recall
pr_err = mmu.PrecisionRecallCurveUncertainty.from_scores(y, scores, 0.85)

# Plot the uncertainty
pr_err.plot()

See Basics section of the docs or the tutorial notebooks for more examples.

Contributing

We very much welcome contributions, please see the contributing section for details.

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

mmu-0.1.0rc1.tar.gz (5.6 MB view details)

Uploaded Source

Built Distributions

mmu-0.1.0rc1-cp310-cp310-win_amd64.whl (162.0 kB view details)

Uploaded CPython 3.10 Windows x86-64

mmu-0.1.0rc1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (267.7 kB view details)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

mmu-0.1.0rc1-cp310-cp310-macosx_11_0_arm64.whl (152.0 kB view details)

Uploaded CPython 3.10 macOS 11.0+ ARM64

mmu-0.1.0rc1-cp310-cp310-macosx_10_13_x86_64.whl (448.7 kB view details)

Uploaded CPython 3.10 macOS 10.13+ x86-64

mmu-0.1.0rc1-cp39-cp39-win_amd64.whl (162.1 kB view details)

Uploaded CPython 3.9 Windows x86-64

mmu-0.1.0rc1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (268.4 kB view details)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

mmu-0.1.0rc1-cp39-cp39-macosx_11_0_arm64.whl (152.1 kB view details)

Uploaded CPython 3.9 macOS 11.0+ ARM64

mmu-0.1.0rc1-cp39-cp39-macosx_10_13_x86_64.whl (448.8 kB view details)

Uploaded CPython 3.9 macOS 10.13+ x86-64

mmu-0.1.0rc1-cp38-cp38-win_amd64.whl (162.0 kB view details)

Uploaded CPython 3.8 Windows x86-64

mmu-0.1.0rc1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (267.5 kB view details)

Uploaded CPython 3.8 manylinux: glibc 2.17+ x86-64

mmu-0.1.0rc1-cp38-cp38-macosx_11_0_arm64.whl (152.0 kB view details)

Uploaded CPython 3.8 macOS 11.0+ ARM64

mmu-0.1.0rc1-cp38-cp38-macosx_10_13_x86_64.whl (448.9 kB view details)

Uploaded CPython 3.8 macOS 10.13+ x86-64

mmu-0.1.0rc1-cp37-cp37m-win_amd64.whl (161.7 kB view details)

Uploaded CPython 3.7m Windows x86-64

mmu-0.1.0rc1-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (273.3 kB view details)

Uploaded CPython 3.7m manylinux: glibc 2.17+ x86-64

mmu-0.1.0rc1-cp37-cp37m-macosx_10_13_x86_64.whl (444.0 kB view details)

Uploaded CPython 3.7m macOS 10.13+ x86-64

File details

Details for the file mmu-0.1.0rc1.tar.gz.

File metadata

  • Download URL: mmu-0.1.0rc1.tar.gz
  • Upload date:
  • Size: 5.6 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.10.2

File hashes

Hashes for mmu-0.1.0rc1.tar.gz
Algorithm Hash digest
SHA256 1ed6b1c82e46718777eed7d71c6f2b80c8cf664cd5c65f4a6030a323f4654a2c
MD5 b65f8df39712ecf8f895463fd0293026
BLAKE2b-256 d356b892f8b60d68a525a8de6a42aa2450edcc4843cadea4da5598f2b89c55a9

See more details on using hashes here.

File details

Details for the file mmu-0.1.0rc1-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: mmu-0.1.0rc1-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 162.0 kB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.10.2

File hashes

Hashes for mmu-0.1.0rc1-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 f3e89d6f9ae76387231fff547967873602638ddedb159dbae5f6bf07e9336abf
MD5 d52e82ee9cd5e7db828e94e53dbc0db4
BLAKE2b-256 6ca0a649c856319474be5347b48e66ddbc199da71df7de092578ef2893b47273

See more details on using hashes here.

File details

Details for the file mmu-0.1.0rc1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for mmu-0.1.0rc1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 39dd1f8eaaf28e49a5016bb997eb1c6ebb170bd83d7e9020e4e3de19b822a76a
MD5 7c3eec353642a2ddad64ffc2102274d3
BLAKE2b-256 6d526586f0bfe7113b7cbcfbaac4e4310e3bb73d50b7e5341a20307c3b1ad703

See more details on using hashes here.

File details

Details for the file mmu-0.1.0rc1-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for mmu-0.1.0rc1-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 663c021e6e0a10b194bfc1f4d3b33d33065c937b7e4edddd22513e9b24c5db3c
MD5 c85692c811acd540bcf9a8c69a513200
BLAKE2b-256 92f1a13ff1314bba6a2078c933d3a2c315805eb7694db6cef74b593be966f955

See more details on using hashes here.

File details

Details for the file mmu-0.1.0rc1-cp310-cp310-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for mmu-0.1.0rc1-cp310-cp310-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 9ab6dabd8a738d441dd90456ca61a05c7c525ba5101db9372b2f07f57932f275
MD5 350488124e936dcc7c429e0632f04d52
BLAKE2b-256 85045961f661a52f5c8f134c3764bb26d584567f12df0cac046823d56faa5582

See more details on using hashes here.

File details

Details for the file mmu-0.1.0rc1-cp39-cp39-win_amd64.whl.

File metadata

  • Download URL: mmu-0.1.0rc1-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 162.1 kB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.10.2

File hashes

Hashes for mmu-0.1.0rc1-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 f744c5cd750433a38da2277375744598cb19418ab7d32e7596f74425834ac642
MD5 02bdd803f40087456e93046f8247f702
BLAKE2b-256 9d7e88cd697a8ea472a5e8ca030850d77152dff0efeca824184a33a641023fca

See more details on using hashes here.

File details

Details for the file mmu-0.1.0rc1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for mmu-0.1.0rc1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 8020ffd181c8510527274554ebfe8abe5a8dca00244a02a0bbbe7ed6d878482a
MD5 88e926581ea8d6ba23edb213671c3b42
BLAKE2b-256 c9adf521c38c0e019b95e4d316fbaae232ef58081f1d526670e37783e0f4eeec

See more details on using hashes here.

File details

Details for the file mmu-0.1.0rc1-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for mmu-0.1.0rc1-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 9d80eadbc409d48c7075f1b9f5faf9dbacdaed5dd4689e7513d14292ef1481de
MD5 9c5112c7327f75c541d27e3f1e0f559b
BLAKE2b-256 6e247d4f095a0713e1ae39491c8ecfcb70cab313f2b1e3734d52fa067ff948f4

See more details on using hashes here.

File details

Details for the file mmu-0.1.0rc1-cp39-cp39-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for mmu-0.1.0rc1-cp39-cp39-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 ed86e5ffb4c16282e7f10b286ef6d55c45eef8f52d240dae1d3cb6a7b1d2e6e6
MD5 b3cc821995b54804156e7ac0a56a8c48
BLAKE2b-256 8c6799515a4c9f4f8b279def9323f292c52f6b5c5e74967897130b97ee2df5db

See more details on using hashes here.

File details

Details for the file mmu-0.1.0rc1-cp38-cp38-win_amd64.whl.

File metadata

  • Download URL: mmu-0.1.0rc1-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 162.0 kB
  • Tags: CPython 3.8, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.10.2

File hashes

Hashes for mmu-0.1.0rc1-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 03c37d46cf6fe12dc66b46fec4c57bd46c42361b0a862b86cdd3ccfb83b37696
MD5 20f49c9ac563e90b52d1ed127cd04697
BLAKE2b-256 6a67974cd34348bcefec7b27d42920b09c1d6af4452b6c2fa0fadc44343ac55d

See more details on using hashes here.

File details

Details for the file mmu-0.1.0rc1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for mmu-0.1.0rc1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 e0f47e1bfa0791647122d34840d8abed98f31266438b9ee446659682a67d0857
MD5 cd69719782d0b0e52535bc64e76417cb
BLAKE2b-256 aa721fee655832db272db6cb3dfc1efa904894dcc9de964419e6067083797289

See more details on using hashes here.

File details

Details for the file mmu-0.1.0rc1-cp38-cp38-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for mmu-0.1.0rc1-cp38-cp38-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 8c526daff9c844d17056477d7beb6dc102954e3e9a2ce094bc9bbfdb07c3756d
MD5 e4d5caf9e5638cecf8028d0a947dd630
BLAKE2b-256 213ebaabba9ec43d22532dda9e4f164aed459ea4441fbcf50f1b659a6091695d

See more details on using hashes here.

File details

Details for the file mmu-0.1.0rc1-cp38-cp38-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for mmu-0.1.0rc1-cp38-cp38-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 81629b8a1c1c2b06d66553c4fc420e63c02ac3ec843214d7765f1a9c2c2be7ad
MD5 b262d9466839514bf56d886a3cd4e175
BLAKE2b-256 5f9b9ee1522731f43b6b800632f55c1408ef2f5321e03f02117061c312ed1e83

See more details on using hashes here.

File details

Details for the file mmu-0.1.0rc1-cp37-cp37m-win_amd64.whl.

File metadata

  • Download URL: mmu-0.1.0rc1-cp37-cp37m-win_amd64.whl
  • Upload date:
  • Size: 161.7 kB
  • Tags: CPython 3.7m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.10.2

File hashes

Hashes for mmu-0.1.0rc1-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 cd512fef5fe8a19d909efb5b6065153c5d21946ffe5212d2f9a3cc0bbd9ae845
MD5 9f898a2bbb30c271a69d12f0ae5f4036
BLAKE2b-256 65779de7c82e336a5e11a400213f9c1741d379af82ef5d7c127fe612ae6704a6

See more details on using hashes here.

File details

Details for the file mmu-0.1.0rc1-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for mmu-0.1.0rc1-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 38acd4ca00c9a57ac3fbbc59b3ac5fc1991f19eeb6b89657759fe0403f51a959
MD5 afc08a9b3677c877ccfc0b655c40e01f
BLAKE2b-256 0c1aae9d4a20357437068b402cfb47e030a29860067a8f56fd91334b50249f1b

See more details on using hashes here.

File details

Details for the file mmu-0.1.0rc1-cp37-cp37m-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for mmu-0.1.0rc1-cp37-cp37m-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 dd960da7e83bd4ef865809c4e59cb9bdea2d982c135f3054d2e52bed8a6230cb
MD5 fc5479d4d91fb07cd21a6e54da8309bd
BLAKE2b-256 27e56f3a9a775eb94a68da401b9aaa7b9644aca72e0311f5f1469790ad9f0823

See more details on using hashes here.

Supported by

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