This function takes the result of the feature_selection function or the wrapper_feat_select function and returns a barplot with the important features
barplot_feat_select(obj, params_barplot, xgb_sort = NULL)
obj | either a data frame or a list from the functions : feature_selection, wrapper_feat_select |
---|---|
params_barplot | a list of parameters needed for plotting the important features |
xgb_sort | sort the xgboost features by "Gain", "Cover" or "Frequency" ( defaults to "Frequency") |
a barplot with the important features of each method
This function takes a data frame (from the feature_selection function) or a list (from the wrapper_feat_select function) and returns a barplot of the important features. If union is TRUE in the params_barplot vector it returns also the average importance of all methods
if (FALSE) { data(iris) X = iris[, -5] y = X[, 1] X = X[, -1] #............................. # plot of the wrapper function #............................. feat = wrapper_feat_select(X, y, params_glmnet = params_glmnet, params_xgboost = params_xgboost, params_ranger = params_ranger, xgb_sort = NULL, CV_folds = 10, stratified_regr = FALSE, cores_glmnet = 2, params_features = params_features) params_barplot = list(keep_features = 5, horiz = TRUE, cex.names = 1.0) barplot_feat_select(feat, params_barplot, xgb_sort = NULL) #....................................... # plot of the feature_selection function #....................................... res = feature_selection(X, y, method = 'glmnet-lasso', params_glmnet = params_glmnet, CV_folds = 5, cores_glmnet = 5) params_barplot = list(keep_features = 5, horiz = TRUE, cex.names = 0.8) barplot_feat_select(res, params_barplot, xgb_sort = NULL) }