| 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_matrixObject of class
"matrix.csr": stores the training set of theDocumentTermMatrixcreated bycreate_matrixtraining_codesObject of class
"factor": stores the training labels for each document in thetraining_matrixslot ofmatrix_container-classclassification_matrixObject of class
"matrix.csr": stores the classification set of theDocumentTermMatrixcreated bycreate_matrixtesting_codesObject of class
"factor": ifvirgin=FALSE, stores the labels for each document in classification_matrixcolumn_namesObject of class
"vector": stores the column names of theDocumentTermMatrixcreated bycreate_matrixvirginObject 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