plot_topN_imp_scores: plot_topN_imp_scores

View source: R/ranger_clf_plot.R

plot_topN_imp_scoresR Documentation

plot_topN_imp_scores

Description

plot_topN_imp_scores

Usage

plot_topN_imp_scores(
  rf_model,
  topN = 4,
  feature_md = NULL,
  feature_id_col = "Feature_ID",
  bar_color = NA,
  outdir = NULL,
  plot_height = 8,
  plot_width = 5
)

Arguments

rf_model

The rf model from rf.out.of.bag or rf.cross.validation

topN

A number indicating how many top important feature need to visualize in the barplot.

feature_md

an optional data.frame including feature IDs and feature annotations.

feature_id_col

The Feature_ID column in the feature metadata.

bar_color

The column name in the feature metadata for coloring the bar plot.

outdir

The output directory.

plot_height

plotting parameter.

plot_width

plotting parameter.

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<-factor(c(rep("1", 20), rep("A", 20), rep("C", 20)))
feature_md <- data.frame(Feature_ID=c("X1", "X2", "X3", "X4", "X5"),
                         Taxon=c("AA", "Bd", "CC", "CC", "AA"))
rf_model<-rf.out.of.bag(x, y)
rf_model<-rf.cross.validation(x, y, nfolds=5)
plot_topN_imp_scores(rf_model, topN=4, feature_md, outdir=NULL, bar_color="Taxon")

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