<br />
<p align="center">
<a href="https://github.com/themis-ai/capsa#gh-light-mode-only" class="only-light">
<img src="https://raw.githubusercontent.com/themis-ai/capsa/main/docs/source/assets/header-light.svg" width="50%"/>
</a>
</p>
<h2><p align="center">A Library for Risk-Aware and Trustworthy Machine Learning</p></h2>
<h4><p align='center'>
<a href="https://themisai.io/capsa/getting_started/basic_usage.html">[🚀 Getting Started]</a>
- <a href="https://themisai.io/capsa/">[📄 Docs]</a>
- <a href="https://www.themisai.io">[🌐 Website]</a>
- <a href="https://themisai.io/company.html">[🧠 We're Hiring!]</a>
- <a href="https://themisai.io/capsa/tutorials/index.html">[💡 Tutorials!]</a>
</p></h4>
<p align="center">
<a href="https://pypi.org/project/capsa/">
<img alt="PyPi Version" src="https://img.shields.io/pypi/pyversions/capsa">
</a>
<a href="https://pypi.org/project/capsa/">
<img alt="PyPi Package Version" src="https://img.shields.io/pypi/v/capsa?color=green">
</a>
<a href="https://pypi.org/project/capsa/">
<img alt="PyPi Downloads" src="https://pepy.tech/badge/capsa">
</a>
<!--
<a href="https://themisai.io/capsa">
<img alt="Documentation" src="https://readthedocs.org/projects/capsa/badge/?version=stable">
</a>
-->
<a href="https://github.com/themis-ai/capsa/blob/main/LICENSE">
<img alt="License" src="https://img.shields.io/github/license/themis-ai/capsa?color=green&logo=slack">
</a>
</p>
<br />
# 👋 Welcome
We know deploying machine learning models can be tough. Today's models are notoriously bad at understanding their own risks -- they are biased on underrepresented data, brittle on challenging out-of-distribution scenarios, and can fail without warning when insufficiently trained.
Ensuring awareness of not one, but all of these risks, requires a tedious process involving changes to your model, its architecture, loss function, optimization procedure, and more.
Luckily, capsa has got you covered! Capsa automatically wraps your model (i.e., like a <i>capsule</i>!) and makes all of the internal changes so it can be end-to-end risk-aware. Capsa abstracts away all of those changes so you don't have to modify any of your existing training or deployment pipelines in order to build state-of-the-art trustworthy machine learning solutions.
# 🚀 Quickstart
## 💾 Installation
capsa is available to be downloaded with Pip:
```bash
pip install capsa
```
## ⭐ Wrap your model!
Eager to make your models risk-aware? Let's go through a quick example of wrapping your model (e.g., using an `MVEWrapper`) to estimate risk from noise in your labels (i.e., aleatoric uncertainty).
```python
import capsa
import tensorflow as tf
# Build your model
model = tf.keras.Sequential(...)
# Wrap the model with capsa to make it risk-aware.
# Capsa takes care of all the architecture, loss,
# and deployment changes so you don't have to!
model = capsa.MVEWrapper(model)
# Compile and train the wrapped model the
# same as you would have done with the
# original model. No changes!
model.compile(...)
model.fit(train_x, train_y, epochs=5)
# The model now outputs `RiskTensor` objects, which
# behave just like a normal `Tensor`, except they also
# contain multiple different quantitative risk measures.
pred_y = model(test_x)
# Returns the aleatoric uncertainty of this prediction
risk = pred_y.aleatoric
```
## 🧠 Tutorials
Hungry for more?
Checkout our <a href="https://themisai.io/capsa/tutorials">tutorials</a> on some more advanced functions with capsa including other forms of risk, composing wrappers together, high-dimensional datasets, and more! All tutorials can be opened directly in Google Collab so you can play around without needing access to GPUs.
# 💪 Contribution
Capsa is being actively maintained and advanced. It has been built with research, extensibility, and community development as a priority. We greatly appreciate contributions to the capsa repository and codebase, including issues, enhancements, and pull requests.
For more details please see <a href="https://themisai.io/capsa/contribute/">here</a>.
# 💡 Support
Capsa currently supports Keras Sequential models, although we are looking at possible solutions for supporting wider range of models. We can't wait to share you some new details soon!
Raw data
{
"_id": null,
"home_page": "https://github.com/themis-ai/capsa",
"name": "capsa",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.5",
"maintainer_email": "",
"keywords": "capsa",
"author": "Themis AI",
"author_email": "info@themisai.io",
"download_url": "https://files.pythonhosted.org/packages/28/79/1454839fcf629b8efaff01613060b6edffd33a89813894a11c3252f5671a/capsa-0.1.5.tar.gz",
"platform": null,
"description": "<br />\n<p align=\"center\">\n <a href=\"https://github.com/themis-ai/capsa#gh-light-mode-only\" class=\"only-light\">\n <img src=\"https://raw.githubusercontent.com/themis-ai/capsa/main/docs/source/assets/header-light.svg\" width=\"50%\"/>\n </a>\n \n</p>\n\n<h2><p align=\"center\">A Library for Risk-Aware and Trustworthy Machine Learning</p></h2>\n\n<h4><p align='center'>\n<a href=\"https://themisai.io/capsa/getting_started/basic_usage.html\">[\ud83d\ude80 Getting Started]</a>\n- <a href=\"https://themisai.io/capsa/\">[\ud83d\udcc4 Docs]</a>\n- <a href=\"https://www.themisai.io\">[\ud83c\udf10 Website]</a>\n- <a href=\"https://themisai.io/company.html\">[\ud83e\udde0 We're Hiring!]</a>\n- <a href=\"https://themisai.io/capsa/tutorials/index.html\">[\ud83d\udca1 Tutorials!]</a>\n</p></h4>\n\n<p align=\"center\">\n <a href=\"https://pypi.org/project/capsa/\">\n <img alt=\"PyPi Version\" src=\"https://img.shields.io/pypi/pyversions/capsa\">\n </a>\n <a href=\"https://pypi.org/project/capsa/\">\n <img alt=\"PyPi Package Version\" src=\"https://img.shields.io/pypi/v/capsa?color=green\">\n </a>\n <a href=\"https://pypi.org/project/capsa/\">\n <img alt=\"PyPi Downloads\" src=\"https://pepy.tech/badge/capsa\">\n </a>\n <!--\n <a href=\"https://themisai.io/capsa\">\n <img alt=\"Documentation\" src=\"https://readthedocs.org/projects/capsa/badge/?version=stable\">\n </a>\n -->\n <a href=\"https://github.com/themis-ai/capsa/blob/main/LICENSE\">\n <img alt=\"License\" src=\"https://img.shields.io/github/license/themis-ai/capsa?color=green&logo=slack\">\n </a>\n</p>\n<br />\n\n# \ud83d\udc4b Welcome\n\nWe know deploying machine learning models can be tough. Today's models are notoriously bad at understanding their own risks -- they are biased on underrepresented data, brittle on challenging out-of-distribution scenarios, and can fail without warning when insufficiently trained.\n\nEnsuring awareness of not one, but all of these risks, requires a tedious process involving changes to your model, its architecture, loss function, optimization procedure, and more.\n\nLuckily, capsa has got you covered! Capsa automatically wraps your model (i.e., like a <i>capsule</i>!) and makes all of the internal changes so it can be end-to-end risk-aware. Capsa abstracts away all of those changes so you don't have to modify any of your existing training or deployment pipelines in order to build state-of-the-art trustworthy machine learning solutions.\n\n# \ud83d\ude80 Quickstart\n\n## \ud83d\udcbe Installation\ncapsa is available to be downloaded with Pip:\n\n```bash\npip install capsa\n```\n\n## \u2b50 Wrap your model!\nEager to make your models risk-aware? Let's go through a quick example of wrapping your model (e.g., using an `MVEWrapper`) to estimate risk from noise in your labels (i.e., aleatoric uncertainty).\n\n```python\nimport capsa\nimport tensorflow as tf\n\n# Build your model\nmodel = tf.keras.Sequential(...)\n\n# Wrap the model with capsa to make it risk-aware.\n# Capsa takes care of all the architecture, loss,\n# and deployment changes so you don't have to!\nmodel = capsa.MVEWrapper(model)\n\n# Compile and train the wrapped model the\n# same as you would have done with the\n# original model. No changes!\nmodel.compile(...)\nmodel.fit(train_x, train_y, epochs=5)\n\n# The model now outputs `RiskTensor` objects, which\n# behave just like a normal `Tensor`, except they also\n# contain multiple different quantitative risk measures.\npred_y = model(test_x)\n\n# Returns the aleatoric uncertainty of this prediction\nrisk = pred_y.aleatoric\n```\n\n## \ud83e\udde0 Tutorials\nHungry for more?\n\nCheckout our <a href=\"https://themisai.io/capsa/tutorials\">tutorials</a> on some more advanced functions with capsa including other forms of risk, composing wrappers together, high-dimensional datasets, and more! All tutorials can be opened directly in Google Collab so you can play around without needing access to GPUs.\n\n\n# \ud83d\udcaa Contribution\n\nCapsa is being actively maintained and advanced. It has been built with research, extensibility, and community development as a priority. We greatly appreciate contributions to the capsa repository and codebase, including issues, enhancements, and pull requests.\n\nFor more details please see <a href=\"https://themisai.io/capsa/contribute/\">here</a>.\n\n# \ud83d\udca1 Support\n\nCapsa currently supports Keras Sequential models, although we are looking at possible solutions for supporting wider range of models. We can't wait to share you some new details soon! \n",
"bugtrack_url": null,
"license": "GNU Affero General Public License v3.0",
"summary": "A data- and model-agnostic neural network wrapper for risk-aware decision making",
"version": "0.1.5",
"split_keywords": [
"capsa"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "28791454839fcf629b8efaff01613060b6edffd33a89813894a11c3252f5671a",
"md5": "f0db06bba07ceb9642f51fa22509ad6e",
"sha256": "151172c18cc1df7ecaacd0c406fae25c8e1ab7c4b44ce1a3b3e3259248076d48"
},
"downloads": -1,
"filename": "capsa-0.1.5.tar.gz",
"has_sig": false,
"md5_digest": "f0db06bba07ceb9642f51fa22509ad6e",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.5",
"size": 48660,
"upload_time": "2023-04-11T03:44:56",
"upload_time_iso_8601": "2023-04-11T03:44:56.801100Z",
"url": "https://files.pythonhosted.org/packages/28/79/1454839fcf629b8efaff01613060b6edffd33a89813894a11c3252f5671a/capsa-0.1.5.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-04-11 03:44:56",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "themis-ai",
"github_project": "capsa",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [],
"lcname": "capsa"
}