rf_modeling: Random Forest Predictive Models

Description Usage Arguments Value Examples

View source: R/rf_modeling.R

Description

The objective is - given the number of features, select the most informative ones and evaluate the predictive random forest model. The feature and model selection performed independently for each round of LOOCV.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
rf_modeling(
  msnset,
  features,
  response,
  pred.cls,
  K = NULL,
  sel.feat = T,
  sel.alg = c("varSelRF", "Boruta", "top"),
  ...
)

Arguments

msnset

MSnSet object

features

character vector features to select from for building prediction model. The features can be either in featureNames(msnset) or in pData(msnset).

response

factor to classify along. Must be only 2 levels.

pred.cls

class to predict

K

specifies the cross-validation type. Default NULL means LOOCV. Another typical value is 10.

sel.feat

logical defining if to select features or use the entire set?

sel.alg

character.

  • varSelRF

  • Boruta

  • top - just selecting top 3 features

...

Extra arguments. Currently passed only to Boruta algorithm.

verbose

0 - silent, 1 - count round, 2 - print selected features at each round

Value

list

prob

is the probabilities (response) from LOOCV that the sample is "case"

features

list of selected features for each iteration of LOOCV

top

top features over all iterations

auc

AUC

pred

prediction perfomance obtained by ROCR::prediction

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
data(srm_msnset)
head(varLabels(msnset))
head(msnset$subject.type)
# reduce to two classes
msnset <- msnset[,msnset$subject.type != "control.1"]
msnset$subject.type <- as.factor(msnset$subject.type)
plotAUC(out)
# top features consistently recurring in the models during LOOCV
print(out$top)
# the AUC
print(out$auc)
# probabilities of classifying the sample right, if the feature selection
# and model training was performed on other samples
plot(sort(out$prob))
abline(h=0.5, col='red')

vladpetyuk/vp.misc documentation built on June 25, 2021, 6:35 a.m.