Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
18 views2 pages

Setup Guide

The document provides instructions for setting up and running the Nursery XAI assignment code, requiring Python 3.8 or later and specific libraries. It details the steps to run the script, which includes downloading a dataset, training models, and generating explainability plots. Additionally, it lists the output files created and offers troubleshooting tips for common installation issues.

Uploaded by

unimurdoch
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views2 pages

Setup Guide

The document provides instructions for setting up and running the Nursery XAI assignment code, requiring Python 3.8 or later and specific libraries. It details the steps to run the script, which includes downloading a dataset, training models, and generating explainability plots. Additionally, it lists the output files created and offers troubleshooting tips for common installation issues.

Uploaded by

unimurdoch
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Instructions to Run Nursery XAI

Assignment Code
1. Environment Setup

Before running the code, ensure you have Python 3.8 or later installed. It is recommended
to use a virtual environment.

2. Required Libraries
Install the following Python libraries using pip:

pip install pandas numpy scikit-learn xgboost matplotlib seaborn


shap lime ucimlrepo

Note: If you encounter an error with SHAP installation, install the required C++ build tools
from:

https://visualstudio.microsoft.com/visual-cpp-build-tools/

3. Running the Script

1. Save the assignment code in a Python file, e.g., Nursery_XAI_Assignment.py.


2. Open VS Code or any code editor of your choice.
3. Navigate to the folder containing the script.
4. Run the script using the command:

python Nursery_XAI_Assignment.py

This will:
- Download and process the Nursery dataset.
- Train Decision Tree, Random Forest, and XGBoost models.
- Evaluate model performance.
- Generate SHAP and LIME explainability plots.
- Save the outputs (plots and explanations) in the working directory.

4. Output Files

The following files will be generated:


- shap_summary_<class>.png — SHAP plots for each class.
- lime_explanation.html — LIME explanation for one prediction.
- rf_feature_importance.png — Random Forest feature importance plot.
- feature_importance_decision_tree.png — Decision Tree feature importance plot.

5. Troubleshooting

- If SHAP fails to install, ensure you have Microsoft C++ Build Tools installed.
- If 'pip' is not recognized, make sure Python and pip are added to your system PATH.
- Use 'python -m pip install <package>' if pip alone doesn't work.

You might also like