distill {distillML} | R Documentation |

## Builds surrogate model from an interpreter object based on the univariate PDP functions of the original model.

### Description

Builds a surrogate model from the PDP functions

### Usage

```
distill(
object,
center.mean = TRUE,
features = 1:length(object$features),
cv = FALSE,
snap.grid = TRUE,
snap.train = TRUE,
params.glmnet = list(),
params.cv.glmnet = list()
)
```

### Arguments

`object` |
The Interpreter object |

`center.mean` |
Boolean value that determines whether to center each column of predictions by their respective means. Default is TRUE |

`features` |
The indices of the features in the Interpreter's features that we want to include as PDP functions in the distilled model. |

`cv` |
Boolean that indicates whether we want to cross-validate our fitted coefficients with a regularizer. This should only be done when regularizing coefficients. |

`snap.grid` |
Boolean function that determines whether the model recalculates each value predicted or uses an approximation from previous calculations. When this parameter is set to TRUE, we approximate the predicted values with prevoius calculations. Default is TRUE. |

`snap.train` |
Boolean that determines whether we use the training data or the equally spaced grid points. By default, this is true, which means we snap to grid points as determined by the training data's marginal distribution. |

`params.glmnet` |
Optional list of parameters to pass to glmnet while fitting PDP curves to resemble the original predictions. By specifying parameters, one can do lasso or ridge regression. |

`params.cv.glmnet` |
Optional list of parameters to pass to cv.glmnet while fitting PDP curves to resemble the original predictions. By specifying parameters, one can do lasso or ridge regression. |

### Value

A surrogate class object that can be used for predictions

### Note

For further details, please refer to the vignette for this method, which includes usage examples.

*distillML*version 0.1.0.13 Index]