Learn R Programming

Laurae (version 0.0.0.9001)

xgb.importance.interactive: xgboost feature importance interactive table

Description

This function interactively plots the table of the feature importance from a xgboost model, provided you give the feature names.

Usage

xgb.importance.interactive(importance, feature_names = NULL, digits = 6,
  pageLength = 20, lengthMenu = c(5, 10, 15, 20, 25, 50, 100, 500),
  gainColor = "lightgreen", coverColor = "lightblue",
  freqColor = "lightgrey")

Arguments

importance
Type: xgboost model, data.table, or data.frame. Your xgboost model to get feature importance from. Or a data.table/data.frame.
feature_names
Type: vector of characters. The feature names to use in the feature importance. If you provide a data.table/data.frame, do not input this argument. Defaults to NULL.
digits
Type: integer. The number of digits to print in the table. Defaults to 6.
pageLength
Type: integer. The number of features to print in a single page. Defaults to 20.
lengthMenu
Type: vector of integers. The selectable number of features to print in a single page. Defaults to c(5, 10, 15, 20, 25, 50, 100, 500).
gainColor
Type: character. The color assigned to bars for Gain depending on its value per feature. Defaults to "lightgreen".
coverColor
Type: character. The color assigned to bars for Cover depending on its value per feature. Defaults to "lightblue".
freqColor
Type: character. The color assigned to bars for Frequency depending on its value per feature. Defaults to "lightgrey".

Value

The "datatable" (not data.table) printed.

Examples

Run this code
## Not run: ------------------------------------
# ## my_model <- xgb.train(...)
# xgb.importnace.interactive(importance = my_model,
#                            feature_names = colnames(data),
#                            digits = 6,
#                            pageLength = 10)
## ---------------------------------------------

Run the code above in your browser using DataLab