# partialDependence

Compute partial dependence

## Syntax

## Description

computes the partial dependence `pd`

= partialDependence(`RegressionMdl`

,`Vars`

)`pd`

between the predictor variables
listed in `Vars`

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

, which contains predictor data.

computes the partial dependence `pd`

= partialDependence(`ClassificationMdl`

,`Vars`

,`Labels`

)`pd`

between the predictor variables
listed in `Vars`

and the scores for the classes specified in
`Labels`

by using the classification model
`ClassificationMdl`

, which contains predictor data.

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

= partialDependence(___,`Name,Value`

)`"UseParallel","true"`

, the
`partialDependence`

function uses parallel computing to perform the
partial dependence calculations.

## Examples

## Input Arguments

## Output Arguments

## More About

## Algorithms

For both a regression model (`RegressionMdl`

) and a classification
model (`ClassificationMdl`

), `partialDependence`

uses a
`predict`

function to predict responses or scores.
`partialDependence`

chooses the proper `predict`

function according to the model 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), then `partialDependence`

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

## Alternative Functionality

`plotPartialDependence`

computes and plots partial dependence values. The function can also create individual conditional expectation (ICE) plots.

## References

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

## Extended Capabilities

## Version History

**Introduced in R2020b**