plot_perf_VS_rand: plot_perf_VS_rand

View source: R/ranger_reg_plot.R

plot_perf_VS_randR Documentation

plot_perf_VS_rand

Description

This outputs a histogram and a p-value showing if the performance of a real regression model significantly better than null models.

Usage

plot_perf_VS_rand(
  x,
  y,
  predicted_y,
  prefix = "train",
  target_field,
  nfolds,
  metric = "MAE",
  permutation = 100,
  n_features = NA,
  outdir = NULL
)

Arguments

x

The train data.

y

The numeric labeling data.

predicted_y

The predicted values for y.

prefix

The prefix for the dataset in the training or testing.

target_field

A string indicating the target field of the metadata for regression.

nfolds

The number of folds in the cross validation. If nfolds > length(y) or nfolds==-1, uses leave-one-out cross-validation. If nfolds was a factor, it means customized folds (e.g., leave-one-group-out cv) were set for CV.

metric

The regression performance metric applied, including MAE, RMSE, MSE, R_squared, Adj_R_squared, or Separman_rho.

permutation

The permutation times for a random guess of regression performance.

n_features

The number of features in the training data.

outdir

The output directory.

Author(s)

Shi Huang

Examples

set.seed(123)
x <- data.frame(rbind(t(rmultinom(7, 75, c(.201,.5,.02,.18,.099))),
            t(rmultinom(8, 75, c(.201,.4,.12,.18,.099))),
            t(rmultinom(15, 75, c(.011,.3,.22,.18,.289))),
            t(rmultinom(15, 75, c(.091,.2,.32,.18,.209))),
            t(rmultinom(15, 75, c(.001,.1,.42,.18,.299)))))
y<- 1:60
rf_model<-rf.out.of.bag(x, y)
p<-plot_perf_VS_rand(x=x, y=y, predicted_y=rf_model$predicted, prefix="train", nfolds=5,
permutation=100, metric="MAE", target_field="age", n_features=5)
p

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