buildPredictor: Build a randomForest object

View source: R/MPMutils.R

buildPredictorR Documentation

Build a randomForest object

Description

Build a Random Forest Classifier (RFC) of class randomForest.

Usage

buildPredictor(model, data, n = 10000, m = 3, vset = NULL, ...)

Arguments

model

An R formula of shape y ~ x1 + x2 + ... + xn. You can use model <- formula("y ~ .") to include all the variables of the input dataset.

data

A matrix or data.frame with subjects as rows and ultrasound features as columns. The outcome should be named "y".

n

Number of trees to be generated by bootstrap.

m

Number of randomly sampled variables per tree branching.

vset

An optional data.frame of the same shape as the input data. This will be used as external validation set. A validation set can be also extracted from the input dataset, using the vpart function.

...

Currently ignored.

Details

This is the class of RFC used in the us.predict and rfc.predict fuctions. The default randomForest object in the morphonode package is an ensemble of 5 RFCs trained over a simulated dataset of 948 subjects (508 non-malignant and 440 malignant profiles), using a nested 5-fold cross-validation scheme. The training/validation details and performances of this dataset are stored in the mpm.rfc object.

Value

A list of 2 objects:

  1. "RFC", an object of class randomForest;

  2. "performance", a list containing RFC performances.

Author(s)

Fernando Palluzzi fernando.palluzzi@gmail.com

References

Fragomeni SM, Moro F, Palluzzi F, Mascilini F, Rufini V, Collarino A, Inzani F, Giacò L, Scambia G, Testa AC, Garganese G (2022). Evaluating the risk of inguinal lymph node metastases before surgery using the Morphonode Predictive Model: a prospective diagnostic study. Ultrasound xx Xxxxxxxxxx xxx Xxxxxxxxxx. 00(0):000-000. <https://doi.org/00.0000/00000000000000000000>

Liaw A, Wiener M. Classification and Regression by randomForest (2002). R News, 2(3):18-22. <https://doi.org/10.1023/A:1010933404324>

See Also

us.predict, rfc.predict, vpart

Examples


# Extract a subset of 500 subjects and an outcome vector of length 30 
# from the default simulated dataset

x <- mosaic::sample(mpm.us, 500, replace = FALSE, prob = NULL)
x <- x[, 2:16]
model <- formula("y ~ .")

# Data partitioning (75% training set, 25% validation set)

x <- vpart(x, p = 0.75)

# RFC building (1000 bootstrapped trees, 3 random variables per split)

rfc <- buildPredictor(model, x$training.set, n = 1000,
                      vset = x$validation.set)
print(rfc$performance)



# RFC building (10000 bootstrapped trees, 3 random variables per split)

rfc <- buildPredictor(model, x$training.set, vset = x$validation.set)
print(rfc$performance)




Morphonodepredictivemodel/morphonode documentation built on Feb. 15, 2023, 4:51 a.m.