> 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-ice.md).

# GBM - ICE

[Code Implementation Here](https://colab.research.google.com/drive/1hIEPr60uUd0wZjjJcR4ZH5l5DZPmQ1T0?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:** Medical Cost Personal  ; **Target:** charges

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

**Accuracy:**&#x20;

### **Implementation of Interpretability**

In this section we will interpret a GBM using ICE plots.

![](https://1181649628-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M5Vxy9PzQFOZjhyK8YP%2F-MEfTt8rKrk18miTRf2E%2F-MEffB--N0Lwe-FiqHFc%2Fimage.png?alt=media\&token=344bdf61-e3c4-4d03-bc40-946e06825c83)

We use the Pycebox library and generate ICE plots for "Smoker" feature against out predicted output of "Charges"

### Visualizations

**ICE plot**

![](https://1181649628-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M5Vxy9PzQFOZjhyK8YP%2F-MEke39OcZFVuuUb_soQ%2F-MEkfVIwrKxSemoXOwLP%2Fimage.png?alt=media\&token=b9059ec9-aa64-4a67-b4f0-bdaaf017bf3a)

In the above plot, we see multiple lines plotted. Each line corresponds to a row in our data. We can see that for some individuals BMI does not affect the charges. But for a few of them, a high BMI seems to increase the charges. Such interpretation can be very useful in showing people the repercussions of having a high BMI.

**ICE plot with PDP line**

![](https://1181649628-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M5Vxy9PzQFOZjhyK8YP%2F-MEke39OcZFVuuUb_soQ%2F-MEkfumzz_bFKmsY34JO%2Fimage.png?alt=media\&token=e348e1a9-e22c-4350-bc0a-a2d820030a80)

The above plot shows the ICE plot along with the aggregation line shown in black. The aggregation line is the same as the PDP line. The PDP line shows that the overall effect of the age is not much, though the charges increase a small bit after a certain age. &#x20;

**Centered ICE plot**

![](https://1181649628-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M5Vxy9PzQFOZjhyK8YP%2F-MEkcAqCEbcTJB_uGXD9%2F-MEkdWTginHM0qfF4knD%2Fimage.png?alt=media\&token=6f87bdc1-99aa-4649-8657-0d72490eef8c)

The Centered ICE plot is centering the curves at a certain point in the feature and displaying only the differences in prediction so that it is easy to interpret.
