Skip to main content

Generate Model Facts Label for AI/ML trust and transparency

Project description

Model Facts

Create a Model Facts label to improve the transparency of your model when communicating with end users. This label provides a framework to interrogate models for biases. It provides information required for comparability in a simple and flexible format.

Last Updated: 18 March, 2025

Framework

Model Facts

Installation

It can be installed from PyPI using:

pip install modelfacts

Note: the template notebooks are only available in the source distribution.

You can also clone this repository and install required packages through:

git clone https://github.com/jhzsquared/model_facts.git
pip install -r requirements.txt

Usage

Model Facts is designed to be flexible, whether you have pre-formatted data and results and just want to fill out a template, or want to generate your own statistics.

Template

  1. pip install jupyter notebook if not already installed
  2. Download the model_facts_template.ipynb notebook.
  3. Create a csv file with the test data, the aligned demographic variables, predictions, baseline, and truth values.
  4. Run the first code cell
  5. Fill out the form
  6. Profit! :)

Note: the template currently only supports metrics from scikit-learn.metrics, binary classification, and regression models. For more complex modeling problems, please reference the other workflows.

DIY

The demo/model_facts_titanic.ipynb notebook provides a simple example of how you can use Model Facts labels on your own dataset with more flexibility through the modelfacts.ModelFacts class.

Extra DIY

Use the modelfacts.ModelFactsLabel class and pass in your own pre-calculated statistics.

model_facts_data = (admin_data, accuracy_data, demographic_data)
mf_label = mfw.ModelFactsLabel(model_facts_data)
table = mf_label(application, warning, source, show=True)

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Make sure to update tests as appropriate.

Reach out if you are interested in joining the team for continued development of this project

Limitations

The automated calculation code currently only supports binary classification and regressions. Users can use their own calculations and the modelfacts.ModelFactsLabel to generate a label from their own statistics.

License

Model Facts is licensed under the MIT license.

Citation

This project was developed as a follow-up to the following paper. Please cite the following if you are using Model Facts labels:

Jessica Zhu, Michel Cukier, Joseph Richardson, Nutrition facts, drug facts, and model facts: putting AI ethics into practice in gun violence research, Journal of the American Medical Informatics Association, Volume 31, Issue 10, October 2024, Pages 2414–2421, https://doi.org/10.1093/jamia/ocae102

or

@article{10.1093/jamia/ocae102,
    author = {Zhu, Jessica and Cukier, Michel and Richardson, Joseph, Jr},
    title = {Nutrition facts, drug facts, and model facts: putting AI ethics into practice in gun violence research},
    journal = {Journal of the American Medical Informatics Association},
    volume = {31},
    number = {10},
    pages = {2414-2421},
    year = {2024},
    month = {05},
    issn = {1527-974X},
    doi = {10.1093/jamia/ocae102},
    url = {https://doi.org/10.1093/jamia/ocae102},
    eprint = {https://academic.oup.com/jamia/article-pdf/31/10/2414/59206288/ocae102.pdf},
}

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

modelfacts-0.0.2.tar.gz (239.1 kB view details)

Uploaded Source

Built Distribution

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

modelfacts-0.0.2-py3-none-any.whl (11.5 kB view details)

Uploaded Python 3

File details

Details for the file modelfacts-0.0.2.tar.gz.

File metadata

  • Download URL: modelfacts-0.0.2.tar.gz
  • Upload date:
  • Size: 239.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.12

File hashes

Hashes for modelfacts-0.0.2.tar.gz
Algorithm Hash digest
SHA256 5477770d7375f60c6ad6a8f33669444e23a1ccb55b4ac57790f615362cea313b
MD5 7a102ecd8d08cac92f9cb65675d2978d
BLAKE2b-256 d0c86cf05ba07ef633b70ec50f1afdb1fde879a0fdffafd22fca3e4657f3d880

See more details on using hashes here.

File details

Details for the file modelfacts-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: modelfacts-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 11.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.12

File hashes

Hashes for modelfacts-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 bc9e60d099c54b356954b87c216910e4eaead2a6bcfc2346f59685fc1b01ff98
MD5 3ed250767a308cb2196ec754bb3f7295
BLAKE2b-256 78d6704fc75304fc5a2317a586b2193644eb5351a3b163e93d92f9ed39797e54

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