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

`plotPartialDependence(`

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

,`Vars`

)`Vars`

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

, 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 `Mdl`

,`Vars`

,`Labels`

)`Vars`

and the scores for the classes specified in
`Labels`

by using the classification model
`Mdl`

, 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 `Mdl`

and
runs `predict`

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

function, see the `predict`

functions in
the following two tables. If `Mdl`

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 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` |

Nonlinear regression | `NonLinearModel` | `predict` |

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

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

**Classification Model Object**

Model Type | Full or Compact Classification Model Object | Function to Predict Labels and Scores |
---|---|---|

Discriminant analysis classifier | `ClassificationDiscriminant` ,
`CompactClassificationDiscriminant` | `predict` |

Multiclass model for support vector machines or other classifiers | `ClassificationECOC` , `CompactClassificationECOC` | `predict` |

Ensemble of learners for classification | `ClassificationEnsemble` , `CompactClassificationEnsemble` ,
`ClassificationBaggedEnsemble` | `predict` |

Gaussian kernel classification model using random feature expansion | `ClassificationKernel` | `predict` |

k-nearest neighbor classifier | `ClassificationKNN` | `predict` |

Linear classification model | `ClassificationLinear` | `predict` |

Multiclass naive Bayes model | `ClassificationNaiveBayes` , `CompactClassificationNaiveBayes` | `predict` |

Support vector machine classifier for one-class and binary classification | `ClassificationSVM` , `CompactClassificationSVM` | `predict` |

Binary decision tree for multiclass classification | `ClassificationTree` , `CompactClassificationTree` | `predict` |

Bagged ensemble of decision trees | `TreeBagger` , `CompactTreeBagger` | `predict` |

`partialDependence`

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

[2] Goldstein, Alex, Adam
Kapelner, Justin Bleich, and Emil Pitkin. “Peeking Inside the Black Box: Visualizing
Statistical Learning with Plots of Individual Conditional Expectation.”
*Journal of Computational and Graphical Statistics* 24, no. 1
(January 2, 2015): 44–65.

[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`