Skip to content
This repository has been archived by the owner on Dec 18, 2023. It is now read-only.

Feat/multiclass metrics #280

Closed
wants to merge 9 commits into from
Closed

Conversation

IanAtCredo
Copy link
Collaborator

@IanAtCredo IanAtCredo commented Dec 7, 2022

Describe your changes

Setting up model types to enable multiclass classification metric routing.

Checklist before requesting a review

  • I have performed a self-review of my code
  • I have built basic tests for new functionality (particularly new evaluators)
  • If new libraries have been added, I have checked that readthedocs API documentation is constructed correctly
  • Will this be part of a major product update? If yes, please write one phrase about this update.

Extra-mile Checklist

  • I have thought expansively about edge cases and written tests for them

@IanAtCredo
Copy link
Collaborator Author

To do:

  • add multiclass classification metrics to list
  • Route a multiclass classification model (or dataset?) to the appropriate metrics
    • find_metrics has a metric_category attribute that we can probably use. We'd need a helper function to go from a list of artifacts -> metric category
  • better messaging if metrics fail

Questions:

  • How do we want to deal with models that we can't identify? For instance, if the model is non-sklearn we won't know what kind of classification it is. Options:
    • We could update the type based on what we see in the dataset (there is a type_of_target function which could inform things). That may be a nice thing to do!
    • Classification type routes to binary classification and we have a good warning?

Modified tabular data to account for non naming of sensitive features.
This caused failure in ModelFairness due to issues with fairlearn.create_metric_frame.
- Created a credoai version for TPER, TNR
@fabrizio-credo
Copy link
Contributor

  • Completed update of MULTICLASS_CLASSIFICATION_FUNCTIONS
  • Created our own version for TPR, TNR

@IanAtCredo IanAtCredo changed the title [WIP] Feat/multiclass metrics Feat/multiclass metrics Dec 9, 2022
@github-actions
Copy link

github-actions bot commented Dec 9, 2022

Coverage

Coverage Report
FileStmtsMissCoverMissing
credoai
   __init__.py30100% 
credoai/artifacts
   __init__.py70100% 
credoai/artifacts/data
   __init__.py00100% 
   base_data.py1071388%55, 136, 155, 158, 173, 180, 187, 191, 195, 199, 211, 214, 221
   comparison_data.py631379%53, 60, 71, 76, 81, 90, 96, 100, 105, 114, 147, 153, 156
   tabular_data.py40685%52, 73, 77, 96, 98, 105
credoai/artifacts/model
   __init__.py00100% 
   base_model.py36294%56, 88
   classification_model.py23196%44
   comparison_model.py110100% 
   constants_model.py20100% 
   regression_model.py11464%43–45, 48
credoai/evaluators
   __init__.py150100% 
   data_fairness.py1471292%83–90, 205, 260–261, 287, 311, 334–340, 356
   data_profiler.py34294%57, 60
   deepchecks.py40392%113–122
   equity.py1533180%78, 181–184, 204, 230–257, 281–296, 307–309, 358–359
   evaluator.py70889%50, 58, 61, 80, 106, 126, 174, 181
   fairness.py1471292%117, 238, 246–251, 312–321, 323, 335–338
   feature_drift.py59198%66
   identity_verification.py112298%144–145
   model_profiler.py741284%128–131, 145–148, 165, 182–183, 192–193, 231
   performance.py1191488%110, 137–143, 232–241, 243, 260–263
   privacy.py118497%410, 447–449
   ranking_fairness.py1341490%136–137, 157, 178, 184–185, 382–404, 409–439
   security.py96199%297
   shap.py871484%119, 127–128, 138–144, 170–171, 253–254, 284–292
   survival_fairness.py675025%29–33, 36–48, 53–64, 67–78, 81–99, 102, 105, 108
credoai/evaluators/utils
   __init__.py30100% 
   fairlearn.py18289%46, 59
   utils.py8188%9
   validation.py802865%14, 34–35, 37–39, 46, 67–74, 80–86, 89, 95–98, 105, 108, 111, 114–115, 119–121
credoai/governance
   __init__.py10100% 
credoai/lens
   __init__.py20100% 
   lens.py1891294%173–174, 210–215, 272, 314, 338, 420, 435, 439, 451
   pipeline_creator.py601280%20–21, 37, 79–91
   utils.py392828%20–27, 49–52, 71–82, 99, 106–109, 128–135
credoai/modules
   __init__.py30100% 
   constants_deepchecks.py20100% 
   constants_metrics.py190100% 
   constants_threshold_metrics.py30100% 
   metric_utils.py241825%15–30, 34–55
   metrics.py61789%62, 66, 69–70, 73, 83, 120
   metrics_credoai.py1346254%43–72, 92–101, 106–108, 131–159, 175–178, 205, 229–230, 293–295, 371–377, 413–414, 484–485
   stats.py392828%11–14, 17–22, 25–27, 30–35, 38–52, 55–60
   stats_utils.py5340%5–8
credoai/utils
   __init__.py50100% 
   common.py1024061%55, 68–69, 75, 84–91, 96–104, 120–126, 131, 136–141, 152–159, 186
   constants.py20100% 
   dataset_utils.py613543%23, 26–31, 50, 54–55, 88–119
   logging.py551376%10–11, 14, 19–20, 23, 27, 44, 58–62
   model_utils.py301163%14–19, 29–30, 35–40
   version_check.py11191%16
TOTAL273152081% 

@fabrizio-credo
Copy link
Contributor

Merged into feat/test_expansion 166d214, we can close this.

@IanAtCredo IanAtCredo deleted the feat/multiclass_metrics branch March 1, 2023 01:30
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants