User Tools

Site Tools


wiki:ai:responsible-ai-test

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
wiki:ai:responsible-ai-test [2025/06/05 14:53] ddehamerwiki: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
- 
 </code> </code>
  
Line 36: Line 35:
 data = fetch_openml(name='adult', version=2, as_frame=True) data = fetch_openml(name='adult', version=2, as_frame=True)
 df = data.frame.dropna() df = data.frame.dropna()
- 
 </code> </code>
  
Line 55: Line 53:
  
 X_train, X_test, y_train, y_test = train_test_split(X, y, stratify=y, random_state=42) X_train, X_test, y_train, y_test = train_test_split(X, y, stratify=y, random_state=42)
- 
 </code> </code>
  
Line 86: Line 83:
  
 clf.fit(X_train, y_train) clf.fit(X_train, y_train)
- 
 </code> </code>
  
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
- 
 </code> </code>
  
Line 131: Line 126:
     feature_metadata=feature_metadata     feature_metadata=feature_metadata
 ) )
- 
 </code> </code>
  
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='opposite')+rai_insights.counterfactual.add(total_CFs=10, desired_class='opposite')
 rai_insights.causal.add(treatment_features=categorical_cols) rai_insights.causal.add(treatment_features=categorical_cols)
- 
 </code> </code>
  
Line 160: Line 153:
 <code -> <code ->
 rai_insights.compute() rai_insights.compute()
- 
 </code> </code>
  
Line 175: Line 167:
  
 ResponsibleAIDashboard(rai_insights) ResponsibleAIDashboard(rai_insights)
- 
 </code> </code>
  
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.  You have to either pull the notebook local and use it from the terminal or register the dashboard/dataset and review it through the portal.   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.  You have to either pull the notebook local and use it from the terminal or register the dashboard/dataset and review it through the portal.
 +  NOTE:  To deploy locally you need to follow the process below.
 +
 +==== Use Local Jupyter Notebook ====
 +
 +  - Download the full notebook (''.ipynb'') to your local machine.
 +  - Create a conda/venv environment with:<code ->
 +pipx install raiwidgets responsibleai scikit-learn ipywidgets jupyter notebooks
 +
 +</code>
 +  - Launch local notebook from the directory you downloaded the file to using:
 +<code ->
 +jupyter notebook
 +
 +</code>
 +  - 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?400}} {{:wiki:ai:screenshot_2025-06-05_at_10.56.15 am.png?400}} {{:wiki:ai:screenshot_2025-06-05_at_10.55.18 am.png?400}} {{:wiki:ai:screenshot_2025-06-05_at_10.55.25 am.png?400}} {{:wiki:ai:screenshot_2025-06-05_at_10.56.28 am.png?400}} {{:wiki:ai:screenshot_2025-06-05_at_10.55.32 am.png?400}} {{:wiki:ai:screenshot_2025-06-05_at_10.55.39 am.png?400}} {{:wiki:ai:screenshot_2025-06-05_at_10.55.48 am.png?400}} {{:wiki:ai:screenshot_2025-06-05_at_10.56.00 am.png?400}} {{:wiki:ai:screenshot_2025-06-05_at_10.56.09 am.png?400}} {{:wiki:ai:screenshot_2025-06-05_at_10.56.15 am.png?400}}
  
 [[ai_knowledge|AI Knowledge]] [[ai_knowledge|AI Knowledge]]
 +
  
wiki/ai/responsible-ai-test.1749135188.txt.gz · Last modified: by ddehamer