Learn R Programming

vip (version 0.3.2)

add_sparklines: Add sparklines

Description

Create an HTML widget to display variable importance scores with a sparkline representation of each features effect (i.e., its partial dependence function).

Usage

add_sparklines(object, fit, digits = 3, free_y = FALSE, verbose = FALSE, ...)

# S3 method for vi add_sparklines(object, fit, digits = 3, free_y = FALSE, verbose = FALSE, ...)

Value

An object of class c("datatables", "htmlwidget"); essentially, a data frame with three columns: Variable, Importance, and Effect (a sparkline representation of the partial dependence function). For "lm"/"glm"-like objects, an additional column, called Sign, is also included which includes the sign (i.e., POS/NEG) of the original coefficient.

Arguments

object

An object that inherits from class "vi".

fit

The original fitted model. Only needed if `vi()` was not called with `method = "firm"`.

digits

Integer specifying the minimal number of significant digits to use for displaying importance scores and, if available, their standard deviations.

free_y

Logical indicating whether or not the the y-axis limits should be allowed to vary for each sparkline. Default is FALSE.

verbose

Logical indicating whether or not to print progress. Default is FALSE.

...

Additional optional arguments to be passed on to partial.

References

Greenwell, B. M., Boehmke, B. C., and McCarthy, A. J. A Simple and Effective Model-Based Variable Importance Measure. arXiv preprint arXiv:1805.04755 (2018).