Description Usage Arguments Details Value Author(s) Examples
Creates a trained model using the specified algorithms.
1 | train_models(container, algorithms, ...)
|
container |
Class of type |
algorithms |
List of algorithms as a character vector (e.g. |
... |
Other parameters to be passed on to |
Calls the train_model
function for each algorithm you list.
Returns a list
of trained models that can be subsequently used in classify_models
to classify new data.
Wouter Van Atteveldt <wouter@vanatteveldt.com>
1 2 3 4 5 6 7 8 | 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"))
|
Loading required package: SparseM
Attaching package: ‘SparseM’
The following object is masked from ‘package:base’:
backsolve
Warning messages:
1: In TermDocumentMatrix.SimpleCorpus(x, control) :
custom functions are ignored
2: In TermDocumentMatrix.SimpleCorpus(x, control) :
custom tokenizer is ignored
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.