MCPcopy
hub / github.com/microsoft/responsible-ai-toolbox

github.com/microsoft/responsible-ai-toolbox @v0.36.0 sqlite

repository ↗ · DeepWiki ↗ · release v0.36.0 ↗
5,015 symbols 14,841 edges 1,466 files 728 documented · 15%
README

MIT license

Responsible AI Widgets Python Build UI deployment to test environment

PyPI raiwidgets PyPI responsibleai PyPI erroranalysis PyPI raiutils PyPI rai_test_utils

npm model-assessment

Responsible AI Toolbox

Responsible AI is an approach to assessing, developing, and deploying AI systems in a safe, trustworthy, and ethical manner, and take responsible decisions and actions.

Responsible AI Toolbox is a suite of tools providing a collection of model and data exploration and assessment user interfaces and libraries that enable a better understanding of AI systems. These interfaces and libraries empower developers and stakeholders of AI systems to develop and monitor AI more responsibly, and take better data-driven actions.

ResponsibleAIToolboxOverview

The Toolbox consists of three repositories:

| Repository| Tools Covered | |--|--| | Responsible-AI-Toolbox Repository (Here) |This repository contains four visualization widgets for model assessment and decision making:

  1. Responsible AI dashboard, a single pane of glass bringing together several mature Responsible AI tools from the toolbox for a holistic responsible assessment and debugging of models and making informed business decisions. With this dashboard, you can identify model errors, diagnose why those errors are happening, and mitigate them. Moreover, the causal decision-making capabilities provide actionable insights to your stakeholders and customers.

  2. Error Analysis dashboard, for identifying model errors and discovering cohorts of data for which the model underperforms.

  3. Interpretability dashboard, for understanding model predictions. This dashboard is powered by InterpretML.

  4. Fairness dashboard, for understanding model’s fairness issues using various group-fairness metrics across sensitive features and cohorts. This dashboard is powered by Fairlearn. | Responsible-AI-Toolbox-Mitigations Repository | The Responsible AI Mitigations Library helps AI practitioners explore different measurements and mitigation steps that may be most appropriate when the model underperforms for a given data cohort. The library currently has two modules:

  5. DataProcessing, which offers mitigation techniques for improving model performance for specific cohorts.

  6. DataBalanceAnalysis, which provides metrics for diagnosing errors that originate from data imbalance either on class labels or feature values.

  7. Cohort: provides classes for handling and managing cohorts, which allows the creation of custom pipelines for each cohort in an easy and intuitive interface. The module also provides techniques for learning different decoupled estimators (models) for different cohorts and combining them in a way that optimizes different definitions of group fairness.|
    Responsible-AI-Tracker Repository |Responsible AI Toolbox Tracker is a JupyterLab extension for managing, tracking, and comparing results of machine learning experiments for model improvement. Using this extension, users can view models, code, and visualization artifacts within the same framework enabling therefore fast model iteration and evaluation processes. Main functionalities include:

  8. Managing and linking model improvement artifacts

  9. Disaggregated model evaluation and comparisons

  10. Integration with the Responsible AI Mitigations library

  11. Integration with mlflow| Responsible-AI-Toolbox-GenBit Repository | The Responsible AI Gender Bias (GenBit) Library helps AI practitioners measure gender bias in Natural Language Processing (NLP) datasets. The main goal of GenBit is to analyze your text corpora and compute metrics that give insights into the gender bias present in a corpus.|

Introducing Responsible AI dashboard

Responsible AI dashboard is a single pane of glass, enabling you to easily flow through different stages of model debugging and decision-making. This customizable experience can be taken in a multitude of directions, from analyzing the model or data holistically, to conducting a deep dive or comparison on cohorts of interest, to explaining and perturbing model predictions for individual instances, and to informing users on business decisions and actions.

ResponsibleAIDashboard

In order to achieve these capabilities, the dashboard integrates together ideas and technologies from several open-source toolkits in the areas of

  • Error Analysis powered by Error Analysis, which identifies cohorts of data with higher error rate than the overall benchmark. These discrepancies might occur when the system or model underperforms for specific demographic groups or infrequently observed input conditions in the training data.
  • Fairness Assessment powered by Fairlearn, which identifies which groups of people may be disproportionately negatively impacted by an AI system and in what ways.

  • Model Interpretability powered by InterpretML, which explains blackbox models, helping users understand their model's global behavior, or the reasons behind individual predictions.

  • Counterfactual Analysis powered by DiCE, which shows feature-perturbed versions of the same datapoint who would have received a different prediction outcome, e.g., Taylor's loan has been rejected by the model. But they would have received the loan if their income was higher by $10,000.

  • Causal Analysis powered by EconML, which focuses on answering What If-style questions to apply data-driven decision-making – how would revenue be affected if a corporation pursues a new pricing strategy? Would a new medication improve a patient’s condition, all else equal?

  • Data Balance powered by Responsible AI, which helps users gain an overall understanding of their data, identify features receiving the positive outcome more than others, and visualize feature distributions.

Responsible AI dashboard is designed to achieve the following goals:

  • To help further accelerate engineering processes in machine learning by enabling practitioners to design customizable workflows and tailor Responsible AI dashboards that best fit with their model assessment and data-driven decision making scenarios.
  • To help model developers create end to end and fluid debugging experiences and navigate seamlessly through error identification and diagnosis by using interactive visualizations that identify errors, inspect the data, generate global and local explanations models, and potentially inspect problematic examples.
  • To help business stakeholders explore causal relationships in the data and take informed decisions in the real world.

This repository contains the Jupyter notebooks with examples to showcase how to use this widget. Get started here.

Installation

Use the following pip command to install the Responsible AI Toolbox.

If running in jupyter, please make sure to restart the jupyter kernel after installing.

pip install raiwidgets

Responsible AI dashboard Customization

The Responsible AI Toolbox’s strength lies in its customizability. It empowers users to design tailored, end-to-end model debugging and decision-making workflows that address their particular needs. Need some inspiration? Here are some examples of how Toolbox components can be put together to analyze scenarios in different ways:

Please note that model overview (including fairness analysis) and data explorer components are activated by default!   | Responsible AI Dashboard Flow| Use Case | |--|--| | Model Overview -> Error Analysis -> Data Explorer | To identify model errors and diagnose them by understanding the underlying data distribution | Model Overview -> Fairness Assessment -> Data Explorer | To identify model fairness issues and diagnose them by understanding the underlying data distribution | Model Overview -> Error Analysis -> Counterfactuals Analysis and What-If | To diagnose errors in individual instances with counterfactual analysis (minimum change to lead to a different model prediction) | Model Overview -> Data Explorer -> Data Balance | To understand the root cause of errors and fairness issues introduced via data imbalances or lack of representation of a particular data cohort | Model Overview -> Interpretability | To diagnose model errors through understanding how the model has made its predictions | Data Explorer -> Causal Inference | To distinguish between correlations and causations in the data or decide the best treatments to apply to see a positive outcome | Interpretability -> Causal Inference | To learn whether the factors that model has used for decision making has any causal effect on the real-world outcome. | Data Explorer -> Counterfactuals Analysis and What-If | To address customer questions about what they can do next time to get a different outcome from an AI. | Data Explorer -> Data Balance | To gain an overall understanding of the data, identify features receiving the positive outcome more than others, and visualize feature distributions

Useful Links

Tabular Examples: - Try the tool: make decisions for house improvements (decision making) - Try the tool: provide recommendations to patients using diabetes data (decision making) - Try the tool: model debugging of a census income prediction model (classification) - Try the tool: model debugging of a housing price prediction model (classification) - Try the tool: model debugging of a diabetes progression prediction model (regression)

Text Examples: - Try the tool: model debugging of an OpenAI Question Answering model on SQuAD - Try the tool: model debugging of a HuggingFace Question Answering model on SQuAD - Try the tool: model debugging of a DBPedia text classification model - [Try the tool: model debugging of a binary text classification model](https://github.com/microsoft/responsible-ai-toolbox/blob/main/notebooks/responsibleaidashboard/text/responsibleaidashboard-blbooksgenre-binary-text-cla

Extension points exported contracts — how you extend this code

ITreeViewNodeProps (Interface)
(no doc) [2 implementers]
libs/error-analysis/src/lib/ErrorAnalysisDashboard/Controls/TreeViewRenderer/TreeViewNode.tsx
ICounterfactualListSetValueProps (Interface)
(no doc) [2 implementers]
libs/counterfactuals/src/lib/CounterfactualListSetValue.tsx
IPlotlyProperty (Interface)
(no doc) [1 implementers]
libs/mlchartlib/src/lib/components/IPlotlyProperty.ts
IFairnessProps (Interface)
(no doc)
apps/widget/src/app/Fairness.tsx
IInterpretData (Interface)
(no doc)
apps/dashboard-e2e/src/describer/interpret/IInterpretData.ts
IAppProps (Interface)
(no doc)
apps/dashboard/src/model-assessment/App.tsx
IModelAssessmentDashboardState (Interface)
(no doc)
libs/model-assessment/src/lib/ModelAssessmentDashboard/ModelAssessmentDashboardState.ts
IDataAnalysisTabStyles (Interface)
(no doc)
libs/dataset-explorer/src/lib/DataAnalysisTab.styles.ts

Core symbols most depended-on inside this repo

get
called by 779
responsibleai/responsibleai/managers/base_manager.py
add
called by 84
responsibleai/responsibleai/managers/base_manager.py
sort
called by 75
libs/core-ui/src/lib/Cohort/Cohort.ts
unwrap
called by 71
libs/core-ui/src/lib/Cohort/Cohort.ts
convert_to_list
called by 69
raiutils/raiutils/data_processing/data_processing_utils.py
create_lightgbm_classifier
called by 60
rai_test_utils/rai_test_utils/models/lightgbm/lightgbm_model_utils.py
ifEnableLargeData
called by 49
libs/core-ui/src/lib/util/buildInitialContext.ts
isValidTransformationName
called by 41
libs/forecasting/src/lib/ForecastingDashboard/Controls/isValidTransformationName.ts

Shape

Method 2,104
Function 1,102
Class 1,012
Interface 721
Enum 63
Route 13

Languages

TypeScript63%
Python37%

Modules by API surface

responsibleai/tests/rai_insights/test_rai_insights_validations.py68 symbols
responsibleai_vision/tests/common_vision_utils.py60 symbols
responsibleai/responsibleai/rai_insights/rai_insights.py42 symbols
libs/error-analysis/src/lib/ErrorAnalysisDashboard/Controls/Matrix/MatrixArea/StatsAggregator.ts41 symbols
raiutils/tests/test_cohort.py34 symbols
erroranalysis/erroranalysis/analyzer/error_analyzer.py34 symbols
responsibleai_text/responsibleai_text/rai_text_insights/rai_text_insights.py33 symbols
responsibleai/tests/model_analysis/test_model_analysis_validations.py33 symbols
responsibleai/responsibleai/managers/counterfactual_manager.py32 symbols
responsibleai_vision/responsibleai_vision/rai_vision_insights/rai_vision_insights.py31 symbols
raiutils/tests/test_data_processing_utils.py30 symbols
notebooks/test_notebooks.py30 symbols

Dependencies from manifests, versioned

@babel/core7.11.1 · 1×
@babel/preset-env7.11.0 · 1×
@babel/preset-react7.10.4 · 1×
@babel/preset-typescript7.10.4 · 1×
@fluentui/react8.58.0 · 1×
@nrwl/cli12.10.0 · 1×
@nrwl/cypress12.10.0 · 1×
@nrwl/eslint-plugin-nx12.10.0 · 1×
@nrwl/jest12.10.0 · 1×
@nrwl/react12.10.0 · 1×
@nrwl/tao12.10.0 · 1×
@nrwl/web12.10.0 · 1×

For agents

$ claude mcp add responsible-ai-toolbox \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact