fits a maximum entropy model given a training matrix and a vector or factor of labels.

Share:

Description

Fits a multinomial logistic regression model of class maxent-class given a matrix or matrix.csr with training data, and a vector or factor with corresponding labels.

Usage

1
tune.maxent(feature_matrix, code_vector, nfold=3, showall=FALSE, verbose=FALSE)

Arguments

feature_matrix

A DocumentTermMatrix or TermDocumentMatrix (package tm), Matrix (package Matrix), matrix.csr (SparseM), data.frame, or matrix.

code_vector

A factor or vector of labels corresponding to each document in the feature_matrix.

nfold

An integer specifying the number of folds to perform for cross-validation. Defaults to 3.

showall

A logical specifying whether to show the accuracy results of all tested parameter configurations. Defaults to FALSE.

verbose

A logical specifying whether to provide descriptive output about the fitting process. Defaults to FALSE, or no output.

Value

Returns an object of class matrix with configurations along the y-axis and parameters along the x-axis.

Author(s)

Timothy P. Jurka <tpjurka@ucdavis.edu>

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# LOAD LIBRARY
library(maxent)

# A DIFFERENT EXAMPLE
data(iris)
attach(iris)

x <- subset(iris, select = -Species)
y <- Species

f <- tune.maxent(x,y,nfold=3,showall=TRUE)