NlpTools API
Class

NlpTools\Optimizers\MaxentGradientDescent

class MaxentGradientDescent extends GradientDescentOptimizer implements MaxentOptimizerInterface

Implement a gradient descent algorithm that maximizes the conditional log likelihood of the training data.

See page 24 - 28 of http://nlp.stanford.edu/pubs/maxent-tutorial-slides.pdf

Methods

__construct($precision = 0.001, $step = 0.1, $maxiter = -1)

from GradientDescentOptimizer
array optimize(array $feature_array)

This function receives an array that contains an array for each document which contains an array of feature identifiers for each class and at the special key '__label__' the actual class of the training document.

from GradientDescentOptimizer
reportProgress($itercount)

from GradientDescentOptimizer

Details

public __construct($precision = 0.001, $step = 0.1, $maxiter = -1)

Parameters

$precision
$step
$maxiter

public array optimize(array $feature_array)

This function receives an array that contains an array for each document which contains an array of feature identifiers for each class and at the special key '__label__' the actual class of the training document.

As a result it contains all the information needed to train a
set of weights with any target. Ex.: If we were training a maxent
model we would try to maximize the CLogLik that can be calculated
from this array.

Parameters

array $feature_array All the data known about the training set

Return Value

array The parameters $l[$i] that minimize F

public reportProgress($itercount)

Parameters

$itercount