Learn R Programming

RTextTools (version 1.4.3)

classify_models: makes predictions from a train_models() object.

Description

Uses a trained model from the train_models function to classify new data.

Usage

classify_models(container, models, ...)

Arguments

container

Class of type matrix_container-class generated by the create_container function.

models

List of models to be used for classification generated by train_models.

Other parameters to be passed on to classify_model.

Details

Use the list returned by train_models to use multiple models for classification.

Examples

Run this code
# NOT RUN {
library(RTextTools)
data(NYTimes)
data <- NYTimes[sample(1:3100,size=100,replace=FALSE),]
matrix <- create_matrix(cbind(data["Title"],data["Subject"]), language="english", 
removeNumbers=TRUE, stemWords=FALSE, weighting=tm::weightTfIdf)
container <- create_container(matrix,data$Topic.Code,trainSize=1:75, testSize=76:100, 
virgin=FALSE)
models <- train_models(container, algorithms=c("RF","SVM"))
results <- classify_models(container, models)
# }

Run the code above in your browser using DataLab