Description Usage Arguments Author(s) Examples
Saves a multinomial logistic regression model of class maxent-class
to a specified file
. This model can then be loaded using function load.model
.
1 | save.model(model,file)
|
model |
An object of class |
file |
The path to a file used to save the model. |
Timothy P. Jurka <tpjurka@ucdavis.edu>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | # LOAD LIBRARY
library(maxent)
# READ THE DATA, PREPARE THE CORPUS, and CREATE THE MATRIX
data <- read.csv(system.file("data/NYTimes.csv.gz",package="maxent"))
corpus <- Corpus(VectorSource(data$Title[1:150]))
matrix <- DocumentTermMatrix(corpus)
# TRAIN USING SPARSEM REPRESENTATION
sparse <- as.compressed.matrix(matrix)
model <- maxent(sparse[1:100,],as.factor(data$Topic.Code)[1:100])
save.model(model,"myModel")
# TRAIN USING REGULAR MATRIX REPRESENTATION
model <- maxent(as.matrix(matrix)[1:100,],as.factor(data$Topic.Code)[1:100])
save.model(model,"myModel")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.