View source: R/ranger_clf_plot.R
plot_clf_feature_selection | R Documentation |
Plot the classification performance against the gradually reduced number of features used in the modeling.
plot_clf_feature_selection(
x,
y,
nfolds = 5,
rf_clf_model,
metric = "AUROC",
positive_class = NA,
outdir = NULL
)
x |
The data frame or data matrix for model training. |
y |
A factor related to the responsive vector for training data. |
nfolds |
The number of folds in the cross-validation for each feature set. |
rf_clf_model |
The rf classification model from |
metric |
The classification performance metric applied. If binary classification, this must be one of "AUROC", "Accuracy", "Kappa", "F1". If multi-class classification, this must be one of "Accuracy", "Kappa". |
positive_class |
A class of the y. |
outdir |
The output directory. |
Shi Huang
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<-factor(c(rep("A", 30), rep("C", 30)))
s<-factor(rep(c("B1", "B2", "B3", "B4"), 15))
rf_model<-rf.cross.validation(x, y, nfolds=5)
summ <- plot_clf_feature_selection(x, y, nfolds=5, rf_model, metric="AUROC", outdir=NULL)
summ <- plot_clf_feature_selection(x, y, nfolds=s, rf_model, metric="AUROC", outdir=NULL)
res<-replicate(10, plot_clf_feature_selection(x, y,
nfolds=5, rf_model, metric="AUROC", outdir=NULL))
do.call(rbind, res["top_n_perf", ])
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.