This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| wiki:ai:responsible-ai-test [2025/06/05 14:53] – ddehamer | wiki:ai:responsible-ai-test [2025/06/16 20:09] (current) – [✅ Step 7: Add Responsible AI Analysis Tools] ddehamer | ||
|---|---|---|---|
| Line 19: | Line 19: | ||
| <code -> | <code -> | ||
| pip install --upgrade raiutils raiwidgets responsibleai ipywidgets | pip install --upgrade raiutils raiwidgets responsibleai ipywidgets | ||
| - | |||
| </ | </ | ||
| Line 36: | Line 35: | ||
| data = fetch_openml(name=' | data = fetch_openml(name=' | ||
| df = data.frame.dropna() | df = data.frame.dropna() | ||
| - | |||
| </ | </ | ||
| Line 55: | Line 53: | ||
| X_train, X_test, y_train, y_test = train_test_split(X, | X_train, X_test, y_train, y_test = train_test_split(X, | ||
| - | |||
| </ | </ | ||
| Line 86: | Line 83: | ||
| clf.fit(X_train, | clf.fit(X_train, | ||
| - | |||
| </ | </ | ||
| Line 107: | Line 103: | ||
| test_data = X_test.copy() | test_data = X_test.copy() | ||
| test_data[target_column] = y_test_clean | test_data[target_column] = y_test_clean | ||
| - | |||
| </ | </ | ||
| Line 131: | Line 126: | ||
| feature_metadata=feature_metadata | feature_metadata=feature_metadata | ||
| ) | ) | ||
| - | |||
| </ | </ | ||
| Line 145: | Line 139: | ||
| rai_insights.explainer.add() | rai_insights.explainer.add() | ||
| rai_insights.error_analysis.add() | rai_insights.error_analysis.add() | ||
| - | rai_insights.counterfactual.add(total_CFs=5, desired_class=' | + | rai_insights.counterfactual.add(total_CFs=10, desired_class=' |
| rai_insights.causal.add(treatment_features=categorical_cols) | rai_insights.causal.add(treatment_features=categorical_cols) | ||
| - | |||
| </ | </ | ||
| Line 160: | Line 153: | ||
| <code -> | <code -> | ||
| rai_insights.compute() | rai_insights.compute() | ||
| - | |||
| </ | </ | ||
| Line 175: | Line 167: | ||
| ResponsibleAIDashboard(rai_insights) | ResponsibleAIDashboard(rai_insights) | ||
| - | |||
| </ | </ | ||
| Line 183: | Line 174: | ||
| NOTE: Due to the way that these URLs are deployed, this step will fail because the notebook sends the wrong headers and this is expected. | NOTE: Due to the way that these URLs are deployed, this step will fail because the notebook sends the wrong headers and this is expected. | ||
| + | NOTE: To deploy locally you need to follow the process below. | ||
| + | |||
| + | ==== Use Local Jupyter Notebook ==== | ||
| + | |||
| + | - Download the full notebook ('' | ||
| + | - Create a conda/venv environment with:< | ||
| + | pipx install raiwidgets responsibleai scikit-learn ipywidgets jupyter notebooks | ||
| + | |||
| + | </ | ||
| + | - Launch local notebook from the directory you downloaded the file to using: | ||
| + | <code -> | ||
| + | jupyter notebook | ||
| + | |||
| + | </ | ||
| + | - This will launch a notebook session in your default browser. | ||
| + | - Open downloaded ipynb file. | ||
| + | - Rerun all steps in local notebook. | ||
| + | |||
| + | ✅ It will render **inline** without CORS issues. | ||
| ==== Output ==== | ==== Output ==== | ||
| - | {{ :wiki:ai:responsibleai.pdf |}} | + | {{:wiki:ai:screenshot_2025-06-05_at_10.55.02 am.png? |
| [[ai_knowledge|AI Knowledge]] | [[ai_knowledge|AI Knowledge]] | ||
| + | |||