Description Usage Arguments Value Examples
This function allows to get the feature importance on a LightGBM model. The model file must be "workingdir"
, where "workingdir"
is the folder and input_model
is the model file name.
1 2 3 |
model |
Type: list. The model file. If a character vector is provided, it is considered to be the model which is going to be saved as |
workingdir |
Type: character. The working directory of the model file. Defaults to |
input_model |
Type: character. The file name of the model. Defaults to |
feature_names |
Type: vector of characters. The names of the features, in the order they were fed to LightGBM. Returns column numbers if left as |
ntreelimit |
Type: integer. The number of trees to select, starting from the first tree. Defaults to |
data.table |
Type: boolean. Whether to return a data.table ( |
A data.table (or data.frame) with 9 columns: c("Feature", "Gain", "Gain_Rel_Ratio", "Gain_Abs_Ratio", "Gain_Std", "Gain_Std_Rel_Ratio", "Gain_Std_Abs_Ratio", "Freq", "Freq_Rel_Ratio", "Freq_Abs_Ratio")
1 2 3 4 5 6 7 8 | ## Not run:
# Feature importance on a single model without any tree limit.
lgbm.fi(model = trained, feature_names = colnames(data), ntreelimit = 0)
# Feature importance on the first model from a cross-validation without any tree limit.
lgbm.fi(model = trained.cv[["Models"]][[1]], feature_names = colnames(data))
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.