matrix_container-class {RTextTools} | R Documentation |
an S4 class containing the training and classification matrices.
Description
An S4 class containing all information necessary to train, classify, and generate analytics for a dataset.
Objects from the Class
Objects could in principle be created by calls of the
form new("matrix_container", ...)
.
The preferred form is to have them created via a call to
create_container
.
Slots
training_matrix
Object of class
"matrix.csr"
: stores the training set of theDocumentTermMatrix
created bycreate_matrix
training_codes
Object of class
"factor"
: stores the training labels for each document in thetraining_matrix
slot ofmatrix_container-class
classification_matrix
Object of class
"matrix.csr"
: stores the classification set of theDocumentTermMatrix
created bycreate_matrix
testing_codes
Object of class
"factor"
: ifvirgin=FALSE
, stores the labels for each document in classification_matrixcolumn_names
Object of class
"vector"
: stores the column names of theDocumentTermMatrix
created bycreate_matrix
virgin
Object of class
"logical"
: boolean specifying whether the classification set is virgin data (TRUE
) or not (FALSE
).
Author(s)
Timothy P. Jurka
Examples
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)
container@training_matrix
container@training_codes
container@classification_matrix
container@testing_codes
container@column_names
container@virgin