train | R Documentation |
Given a Task, creates a model for the learning machine which can be used for predictions on new data.
train(learner, task, subset = NULL, weights = NULL)
learner |
(Learner | |
task |
(Task) |
subset |
(integer | logical | |
weights |
(numeric) |
(WrappedModel).
predict.WrappedModel
training.set = sample(seq_len(nrow(iris)), nrow(iris) / 2)
## use linear discriminant analysis to classify iris data
task = makeClassifTask(data = iris, target = "Species")
learner = makeLearner("classif.lda", method = "mle")
mod = train(learner, task, subset = training.set)
print(mod)
## use random forest to classify iris data
task = makeClassifTask(data = iris, target = "Species")
learner = makeLearner("classif.rpart", minsplit = 7, predict.type = "prob")
mod = train(learner, task, subset = training.set)
print(mod)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.