Main Content

Create partial dependence plot (PDP) and individual conditional expectation (ICE) plots

`plotPartialDependence(`

computes and plots the partial dependence between the predictor variables listed
in `RegressionMdl`

,`Vars`

)`Vars`

and the responses predicted by using the regression
model `RegressionMdl`

, which contains predictor data.

If you specify one variable in

`Vars`

, the function creates a line plot of the partial dependence against the variable.If you specify two variables in

`Vars`

, the function creates a surface plot of the partial dependence against the two variables.

`plotPartialDependence(`

computes and plots the partial dependence between the predictor variables listed
in `ClassificationMdl`

,`Vars`

,`Labels`

)`Vars`

and the scores for the classes specified in
`Labels`

by using the classification model
`ClassificationMdl`

, which contains predictor data.

If you specify one variable in

`Vars`

and one class in`Labels`

, the function creates a line plot of the partial dependence against the variable for the specified class.If you specify one variable in

`Vars`

and multiple classes in`Labels`

, the function creates a line plot for each class on one figure.If you specify two variables in

`Vars`

and one class in`Labels`

, the function creates a surface plot of the partial dependence against the two variables.

`plotPartialDependence(___,`

uses new predictor data `Data`

)`Data`

. You can specify
`Data`

in addition to any of the input argument
combinations in the previous syntaxes.

`plotPartialDependence(___,`

uses additional options specified by one or more name-value pair arguments. For
example, if you specify `Name,Value`

)`'Conditional','absolute'`

, the
`plotPartialDependence`

function creates a figure
including a PDP, a scatter plot of the selected predictor variable and predicted
responses or scores, and an ICE plot for each observation.

`plotPartialDependence`

uses a `predict`

function
to predict responses or scores. `plotPartialDependence`

chooses the
proper `predict`

function according to the model
(`RegressionMdl`

or `ClassificationMdl`

) and
runs `predict`

with its default settings. For details about each
`predict`

function, see the `predict`

functions in
the following two tables. If the specified model is a tree-based model (not including a
boosted ensemble of trees) and `'Conditional'`

is
`'none'`

, then `plotPartialDependence`

uses the
weighted traversal algorithm instead of the `predict`

function. For
details, see Weighted Traversal Algorithm.

**Regression Model Object**

Model Type | Full or Compact Regression Model Object | Function to Predict Responses |
---|---|---|

Bootstrap aggregation for ensemble of decision trees | `CompactTreeBagger` | `predict` |

Bootstrap aggregation for ensemble of decision trees | `TreeBagger` | `predict` |

Ensemble of regression models | `RegressionEnsemble` , `RegressionBaggedEnsemble` , `CompactRegressionEnsemble` | `predict` |

Gaussian kernel regression model using random feature expansion | `RegressionKernel` | `predict` |

Gaussian process regression | `RegressionGP` , `CompactRegressionGP` | `predict` |

Generalized additive model | `RegressionGAM` , `CompactRegressionGAM` | `predict` |

Generalized linear mixed-effect model | `GeneralizedLinearMixedModel` | `predict` |

Generalized linear model | `GeneralizedLinearModel` , `CompactGeneralizedLinearModel` | `predict` |

Linear mixed-effect model | `LinearMixedModel` | `predict` |

Linear regression | `LinearModel` , `CompactLinearModel` | `predict` |

Linear regression for high-dimensional data | `RegressionLinear` | `predict` |

Neural network regression model | `RegressionNeuralNetwork` , `CompactRegressionNeuralNetwork` | `predict` |

Nonlinear regression | `NonLinearModel` | `predict` |

Regression tree | `RegressionTree` , `CompactRegressionTree` | `predict` |

Support vector machine | `RegressionSVM` , `CompactRegressionSVM` | `predict` |

**Classification Model Object**

`partialDependence`

computes partial dependence without visualization. The function can compute partial dependence for two variables and multiple classes in one function call.

[3] Hastie, Trevor, Robert
Tibshirani, and Jerome Friedman. *The Elements of Statistical Learning. New
York*, NY: Springer New York, 2001.

`lime`

| `oobPermutedPredictorImportance`

| `partialDependence`

| `predictorImportance (RegressionEnsemble)`

| `predictorImportance (RegressionTree)`

| `relieff`

| `sequentialfs`

| `shapley`