plot_reg_feature_selection: plot_reg_feature_selection

View source: R/ranger_reg_plot.R

plot_reg_feature_selectionR Documentation

plot_reg_feature_selection

Description

Plot the regression performance against the reduced number of features used in the modeling.

Usage

plot_reg_feature_selection(
  x,
  y,
  rf_reg_model,
  nfolds = 5,
  metric = "MAE",
  unit = NA,
  outdir = NULL
)

Arguments

x

The data frame or data matrix for model training.

y

The numeric values for labeling data.

rf_reg_model

The rf regression model from rf.out.of.bag

nfolds

The number of folds in the cross-validation for each feature set.

metric

The regression performance metric applied. This must be one of "MAE", "RMSE", "MSE", "MAPE".

unit

The unit of numeric metadata variables that can be printed in the output figure.

outdir

The output directory.

Author(s)

Shi Huang

Examples

set.seed(123)
require("gtools")
n_features <- 100
prob_vec <- rdirichlet(5, sample(n_features))
x <- data.frame(rbind(t(rmultinom(7, 7*n_features, prob_vec[1, ])),
            t(rmultinom(8, 8*n_features, prob_vec[2, ])),
            t(rmultinom(15, 15*n_features, prob_vec[3, ])),
            t(rmultinom(15, 15*n_features, prob_vec[4, ])),
            t(rmultinom(15, 15*n_features, prob_vec[5, ]))))
y<- 1:60
rf_reg_model<-rf.out.of.bag(x, y)
rf_reg_model<-rf.cross.validation(x, y)
fs_summ <- plot_reg_feature_selection(x, y, rf_reg_model, metric="MAE", outdir=NULL)

shihuang047/crossRanger documentation built on Feb. 7, 2023, 10:03 p.m.