Description Usage Arguments Value Author(s) Examples
View source: R/create_container.R
Given a DocumentTermMatrix
from the tm package and corresponding document labels, creates a container of class matrix_container-class
that can be used for training and classification (i.e. train_model
, train_models
, classify_model
, classify_models
)
1 | create_container(matrix, labels, trainSize=NULL, testSize=NULL, virgin)
|
matrix |
A document-term matrix of class |
labels |
A |
trainSize |
A range (e.g. |
testSize |
A range (e.g. |
virgin |
A logical ( |
A container of class matrix_container-class
that can be passed into other functions such as train_model
, train_models
, classify_model
, classify_models
, and create_analytics
.
Timothy P. Jurka <tpjurka@ucdavis.edu>, Loren Collingwood <loren.collingwood@gmail.com>
1 2 3 4 5 6 7 | 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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.