classify_models: makes predictions from a train_models() object.

Description Usage Arguments Details Author(s) Examples

View source: R/classify_models.R

Description

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

Usage

1
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.

Author(s)

Wouter Van Atteveldt <wouter@vanatteveldt.com>, Timothy P. Jurka <tpjurka@ucdavis.edu>

Examples

1
2
3
4
5
6
7
8
9
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)

Example output

Loading required package: SparseM

Attaching package: 'SparseM'

The following object is masked from 'package:base':

    backsolve

RTextTools documentation built on April 26, 2020, 9:05 a.m.