Description Usage Arguments Value Examples
This function allows to plot the feature importance on a LightGBM model.
1 2 3 |
model |
Type: list, data.table, or data.frame. The trained model (with feature importance), or the feature importance table. If a list is provided, the trained model must have had |
n_best |
Type: integer. The maximum amount of features to plot. Defaults to |
no_log |
Type: boolean. Whether to NOT apply a log10 scale to the plot. Defaults to |
low |
Type: character. The color when the relative gain is |
high |
Type: character. The color when the relative gain is |
rescaler |
Type: character. The transformation of the color scale. Defaults to |
is.cv |
Type: boolean. Whether the input is issued from a cross-validation or not. Defaults to |
multipresence |
Type: boolean. Whether in a cross-validation, only the features which always appear are kept. Otherwise, they are thrown away for safety. Defaults to |
plot |
Type: boolean. Whether to print a plot. Defaults to |
A ggplot2 object which contains the plot.
1 2 3 4 5 6 7 8 | ## Not run:
# Feature importance on a single model without any tree limit, 20 best features are plotted.
feature_imp <- lgbm.fi(model = trained, feature_names = colnames(data), ntreelimit = 0)
feature_plot <- lgbm.fi.plot(feature_imp, n_best = 20, rescaler = "log",
is.cv = FALSE, multipresence = FALSE, plot = FALSE)
print(featuer_plot)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.