> For the complete documentation index, see [llms.txt](https://maheshwarappa-a.gitbook.io/explainable-ai-1/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://maheshwarappa-a.gitbook.io/explainable-ai-1/implementation-of-these-techniques-on-different-models/gbm-pdp.md).

# GBM - PDP

[Code Implementation Here](https://colab.research.google.com/drive/1SiKKQ5T9rgrYjtDVEEraN1QZxTnztDF8?usp=sharing)

### What is GBM?

* Gradient Boosting Machine is a machine learning algorithm that forms an ensemble of weakly predicted decision trees
* It constructs a forward stage-wise additive model by implementing gradient descent in function space
* Also known as MART (Multiple Additive Regression Trees) and GBRT (Gradient Boosted Regression Trees)

### Making the Model

**Dataset:** Pima Indians Diabetes; **Target:** Outcome

The data is trained by calling the GradientBoostingClassifier function from Scikit learn Library

**Accuracy:**&#x20;

### **Implementation of Interpretability**

For this model, we will interpret with Partial Dependence Plots.&#x20;

![](https://1181649628-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M5Vxy9PzQFOZjhyK8YP%2F-MEfTt8rKrk18miTRf2E%2F-MEfamNr5AFv0CQi4nGm%2Fimage.png?alt=media\&token=c5a56975-e1ea-43a4-bb42-ce75e26a5da5)

With just few lines of code, we can plot the PDPs for any dataset using the sklearn partial\_dependence library.

### Visualizations

**PDP for every feature**

![](https://1181649628-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M5Vxy9PzQFOZjhyK8YP%2F-MEfTt8rKrk18miTRf2E%2F-MEfbIMVi0-utHTLah_d%2Fimage.png?alt=media\&token=bf5a5b99-3189-4860-930f-1b0adbce68b2)

The above plot shows how change in output varies with variations in feature values. Some key points for interpretation from the above plots:

* As Pregnancies increase, the person's chances of becoming diabetic go up
* Higher the Glucose, higher the chances of person becoming diabetic
* BMI more than 25 increases an individuals chances of becoming diabetic

&#x20;**3-D PDPs**

![](https://1181649628-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M5Vxy9PzQFOZjhyK8YP%2F-MEfTt8rKrk18miTRf2E%2F-MEfcp8yXjzuB6IpNZpE%2Fimage.png?alt=media\&token=478ab3b3-9f08-40d5-beed-d00c4712794c)

These plots show the combined effect of two features on the change in output. As seen above, a reduction in both - Insulin and DiabetesPedigreeFunction, results in negative change of a person being diabetic (nearing non-diabetic situation).

**PDP interact plot**&#x20;

![](https://1181649628-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M5Vxy9PzQFOZjhyK8YP%2F-MEfTt8rKrk18miTRf2E%2F-MEfeHMoH8oWZu97hWG5%2Fimage.png?alt=media\&token=ee75a8a8-1469-4da4-8e8b-ef2e587a175b)

The below plot shows the change output prediction (value inside square) for every combination of values between the features Insulin and DiabetesPedigreeFunction(values given by scale).
