Giter Site home page Giter Site logo

maciejwie / capsa-core Goto Github PK

View Code? Open in Web Editor NEW

This project forked from vballoli/capsa-core

0.0 0.0 0.0 71.48 MB

A data- and model-agnostic neural network wrapper for risk-aware decision making.

Home Page: https://themisai.io

License: GNU Affero General Public License v3.0

Python 1.74% Jupyter Notebook 98.25% Dockerfile 0.01%

capsa-core's Introduction


A Library for Risk-Aware and Trustworthy Machine Learning

PyPi Version PyPi Package Version PyPi Downloads License


๐Ÿ‘‹ 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 capsule!) 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:

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).

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 tutorials 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 here.

๐Ÿ’ก 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!

capsa-core's People

Contributors

iaroslavelistratov avatar egesko avatar aamini avatar reza-themisai avatar samir-atra avatar fynnsu avatar slolla avatar elahea2020 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.