train.randomForest: train.randomForest

Description Usage Arguments Value Note See Also Examples

View source: R/train.R

Description

Provides a wrapping function for the randomForest.

Usage

1

Arguments

formula

a formula describing the model to be fitted (for the print method, an randomForest object).

data

an optional data frame containing the variables in the model. By default the variables are taken from the environment which randomForest is called from.

...

optional parameters to be passed to the low level function randomForest.default.

subset

an index vector indicating which rows should be used. (NOTE: If given, this argument must be named.)

na.action

A function to specify the action to be taken if NAs are found. (NOTE: If given, this argument must be named.)

Value

A object randomForest.prmdt with additional information to the model that allows to homogenize the results.

Note

the parameter information was taken from the original function randomForest.

See Also

The internal function is from package randomForest.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
data("iris")

n <- seq_len(nrow(iris))
.sample <- sample(n, length(n) * 0.75)
data.train <- iris[.sample,]
data.test <- iris[-.sample,]

modelo.rf <- train.randomForest(Species~., data.train)
modelo.rf
prob <- predict(modelo.rf, data.test, type = "prob")
prob
prediccion <- predict(modelo.rf, data.test, type = "class")
prediccion
confusion.matrix(data.test, prediccion)

PROMiDAT/trainR documentation built on Oct. 27, 2020, 8:33 p.m.