Description Objects from the Class Slots Author(s) Examples
An S4 class containing the trained maximum entropy model and its corresponding weights as a data.frame with three columns: Weight, Label, and Feature.
Objects could in principle be created by calls of the
form new("maxent", ...).
The preferred form is to have them created via a call to
maxent.
modelObject of class "character":
stores the trained maximum entropy model as returned from maxent
weightsObject of class "data.frame":
contains the weights of the trained maximum entropy model, with three columns: Weight, Label, and Feature.
Timothy P. Jurka <tpjurka@ucdavis.edu>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | # 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])
class(model)
model@model
model@weights
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.