modelmetricuncertainty

Python package for Model Metric Uncertainty estimation

https://github.com/rurlus/modelmetricuncertainty

Science Score: 31.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (13.6%) to scientific vocabulary

Keywords

data-science python science uncertainty

Keywords from Contributors

data-profilers mesh sequences statistical-tests interactive mlops hacking covariate-shift dataset-shift drift-detection
Last synced: 6 months ago · JSON representation ·

Repository

Python package for Model Metric Uncertainty estimation

Basic Info
  • Host: GitHub
  • Owner: RUrlus
  • License: apache-2.0
  • Language: C++
  • Default Branch: stable
  • Homepage:
  • Size: 5.59 MB
Statistics
  • Stars: 12
  • Watchers: 4
  • Forks: 0
  • Open Issues: 7
  • Releases: 3
Topics
data-science python science uncertainty
Created over 4 years ago · Last pushed over 1 year ago
Metadata Files
Readme Changelog License Citation Codeowners

README.rst

==============================
MMU - Model-Metric-Uncertainty
==============================

**A library for the evaluation of model performance and estimation of the uncertainty on these metrics.**

.. figure:: docs/source/figs/pr_curve_mult_w_points.png
    :alt: Uncertainty on the precision-recall curve
    :align: center

.. image:: https://github.com/RUrlus/ModelMetricUncertainty/actions/workflows/macos.yml/badge.svg?branch=stable
    :target: https://github.com/RUrlus/ModelMetricUncertainty/actions/workflows/macos.yml
    :alt: MacOS build
.. image:: https://github.com/RUrlus/ModelMetricUncertainty/actions/workflows/linux.yml/badge.svg?branch=stable
    :target: https://github.com/RUrlus/ModelMetricUncertainty/actions/workflows/linux.yml
    :alt: Linux build
.. image:: https://github.com/RUrlus/ModelMetricUncertainty/actions/workflows/windows.yml/badge.svg?branch=stable
    :target: https://github.com/RUrlus/ModelMetricUncertainty/actions/workflows/windows.yml
    :alt: Windows build
.. image:: https://readthedocs.org/projects/mmu/badge/?version=latest
    :target: https://mmu.readthedocs.io/en/latest/?badge=latest
    :alt: Documentation
.. image:: https://img.shields.io/github/license/RUrlus/modelmetricuncertainty
    :target: https://github.com/RUrlus/carma/blob/stable/LICENSE
    :alt: License
.. image:: http://img.shields.io/pypi/v/mmu.svg
    :target: https://pypi.org/project/mmu/
    :alt: PyPi

`Documentation `_
--------------------------------------------------------

This package was developed as part of the paper `Pointwise sampling uncertainties on the Precision-Recall curve `_.
If you use this package as part of your research please cite using the CITATION file.


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.

.. code-block:: bash

    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.

.. code-block:: bash

    pip install mmu --no-binary mmu

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

Usage
-----

.. code-block:: python3

    import mmu

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

    # Compute the joint uncertainty on precision-recall curve
    pr_err = mmu.PrecisionRecallCurveUncertainty.from_scores(y, scores)
    
    # 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.

Owner

  • Name: Ralph Urlus
  • Login: RUrlus
  • Kind: user
  • Location: Amsterdam, Netherlands
  • Company: ING

Data scientist working at ING Analytics WB in the Netherlands.

Citation (CITATION)

@InProceedings{pmlr-v206-urlus23a,
  title = 	 {Pointwise sampling uncertainties on the Precision-Recall curve},
  author =       {Urlus, Ralph E.Q. and Baak, Max and Collot, St\'ephane and Fridman Rojas, Ilan},
  booktitle = 	 {Proceedings of The 26th International Conference on Artificial Intelligence and Statistics},
  pages = 	 {8211--8232},
  year = 	 {2023},
  editor = 	 {Ruiz, Francisco and Dy, Jennifer and van de Meent, Jan-Willem},
  series = 	 {Proceedings of Machine Learning Research},
  month = 	 {25--27 Apr},
  publisher =    {PMLR},
  pdf = 	 {https://proceedings.mlr.press/v206/urlus23a/urlus23a.pdf},
  url = 	 {https://proceedings.mlr.press/v206/urlus23a.html},
}

GitHub Events

Total
  • Watch event: 1
Last Year
  • Watch event: 1

Committers

Last synced: over 1 year ago

All Time
  • Total Commits: 391
  • Total Committers: 5
  • Avg Commits per committer: 78.2
  • Development Distribution Score (DDS): 0.046
Past Year
  • Commits: 0
  • Committers: 0
  • Avg Commits per committer: 0.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
Ralph Urlus r****v@g****m 373
dependabot[bot] 4****] 8
Stephane Collot s****t@g****m 6
Ralph Urlus R****s 3
Stephane Collot s****t@i****m 1
Committer Domains (Top 20 + Academic)
ing.com: 1

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 21
  • Total pull requests: 50
  • Average time to close issues: about 2 months
  • Average time to close pull requests: 7 days
  • Total issue authors: 3
  • Total pull request authors: 3
  • Average comments per issue: 0.62
  • Average comments per pull request: 0.24
  • Merged pull requests: 37
  • Bot issues: 0
  • Bot pull requests: 14
Past Year
  • Issues: 1
  • Pull requests: 2
  • Average time to close issues: 34 minutes
  • Average time to close pull requests: N/A
  • Issue authors: 1
  • Pull request authors: 1
  • Average comments per issue: 3.0
  • Average comments per pull request: 0.0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • RUrlus (19)
  • KucherInna (1)
  • dsnsabari (1)
Pull Request Authors
  • RUrlus (32)
  • dependabot[bot] (14)
  • stephanecollot (4)
Top Labels
Issue Labels
C++ (8) bug (3) enhancement (2) CICD (1) Python (1)
Pull Request Labels
dependencies (14) github_actions (14)

Dependencies

.github/workflows/asan.yml actions
  • actions/checkout v3 composite
  • actions/setup-python v4 composite
  • fkirc/skip-duplicate-actions master composite
.github/workflows/build.yml actions
  • actions/checkout v3 composite
  • actions/setup-python v4 composite
  • fkirc/skip-duplicate-actions master composite
  • seanmiddleditch/gha-setup-ninja master composite
.github/workflows/linux.yml actions
  • actions/checkout v3 composite
  • actions/setup-python v4 composite
  • fkirc/skip-duplicate-actions master composite
.github/workflows/macos.yml actions
  • actions/checkout v3 composite
  • actions/setup-python v4 composite
  • fkirc/skip-duplicate-actions master composite
.github/workflows/valgrind.yml actions
  • actions/checkout v3 composite
  • actions/setup-python v4 composite
  • fkirc/skip-duplicate-actions master composite
.github/workflows/wheels.yml actions
  • actions/checkout v3 composite
  • actions/download-artifact v3 composite
  • actions/upload-artifact v3 composite
  • pypa/gh-action-pypi-publish v1.6.4 composite
.github/workflows/windows.yml actions
  • actions/checkout v3 composite
  • actions/setup-python v4 composite
  • fkirc/skip-duplicate-actions master composite
docs/requirements.txt pypi
  • docutils *
  • sphinx *
  • sphinx-autoapi *
  • sphinx-rtd-theme *
pyproject.toml pypi
setup.py pypi
external/pcg-cpp/LICENSE.spdx rubygems