microsoft / responsible-ai-toolbox-mitigations

Python library for implementing Responsible AI mitigations.
https://responsible-ai-toolbox-mitigations.readthedocs.io/en/latest/
MIT License
57 stars 6 forks source link

Cohort managing classes #45

Closed mrfmendonca closed 1 year ago

mrfmendonca commented 1 year ago

This PR adds the following new functionalities:

  1. A new cohort module that defines the CohortDefinition and CohortManager classes. These classes allow the creation and handling of multiple cohorts using a simple and intuitive interface. It also allows creating different data pipelines for each cohort, which enables new ways to process a dataset;
  2. Multiple new notebooks showcasing the functionalities of the new cohort classes. There are two types of notebooks: the tutorial notebooks (one for each of the new classes), and the cohort case study notebooks (which shows how to use these new classes in real scenarios).
  3. Pytests for the new cohort classes

This PR also adds several minor bug fixes, as well as a reorganization of the utility module. Prior to this PR, all the utility functions were placed in the dataprocessing module. However, since these utilities are generic (and not specific to the classes in the dataprocessing module), then we moved these utility functions to their own module, called utils module. In there, the utility functions were reorganized and updated to account for multiclass problems (previously, some utility functions only worked for binary classification or regression).

codecov[bot] commented 1 year ago

Codecov Report

Merging #45 (3c5542c) into main (775830f) will increase coverage by 2.07%. The diff coverage is 99.21%.

@@            Coverage Diff             @@
##             main      #45      +/-   ##
==========================================
+ Coverage   94.04%   96.12%   +2.07%     
==========================================
  Files          36       49      +13     
  Lines        2689     4521    +1832     
==========================================
+ Hits         2529     4346    +1817     
- Misses        160      175      +15     
Impacted Files Coverage Δ
raimitigations/cohort/cohort_manager.py 99.06% <ø> (ø)
raimitigations/cohort/decoupled_class/__init__.py 100.00% <ø> (ø)
...ons/cohort/decoupled_class/decoupled_classifier.py 98.97% <ø> (ø)
...gations/cohort/decoupled_class/decoupled_cohort.py 96.74% <ø> (ø)
...igations/cohort/decoupled_class/decoupled_utils.py 98.38% <ø> (ø)
raimitigations/cohort/utils.py 75.22% <ø> (ø)
raimitigations/dataprocessing/__init__.py 100.00% <ø> (ø)
raimitigations/dataprocessing/data_processing.py 98.98% <ø> (+0.73%) :arrow_up:
raimitigations/dataprocessing/encoder/encoder.py 95.74% <ø> (+0.29%) :arrow_up:
raimitigations/dataprocessing/encoder/ohe.py 93.65% <ø> (-2.96%) :arrow_down:
... and 49 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.