A base class providing generic functionality for both small and large maximum entropy models. Cannot be instantiated.
Methods
beginlogging(filename[, freq]) | Enable logging params for each fn evaluation to files named ‘filename.freq.pickle’, ‘filename.(2*freq).pickle’, ... |
clearcache() | Clears the interim results of computations depending on the |
crossentropy(fx[, log_prior_x, base]) | Returns the cross entropy H(q, p) of the empirical |
dual([params, ignorepenalty, ignoretest]) | Computes the Lagrangian dual L(theta) of the entropy of the |
endlogging() | Stop logging param values whenever setparams() is called. |
entropydual([params, ignorepenalty, ignoretest]) | Computes the Lagrangian dual L(theta) of the entropy of the |
fit(K[, algorithm]) | Fit the maxent model p whose feature expectations are given |
grad([params, ignorepenalty]) | Computes or estimates the gradient of the entropy dual. |
log(params) | This method is called every iteration during the optimization process. |
logparams() | Saves the model parameters if logging has been |
normconst() | Returns the normalization constant, or partition function, for the current model. |
reset([numfeatures]) | Resets the parameters self.params to zero, clearing the cache variables dependent on them. |
setcallback([callback, callback_dual, ...]) | Sets callback functions to be called every iteration, every function evaluation, or every gradient evaluation. |
setparams(params) | Set the parameter vector to params, replacing the existing parameters. |
setsmooth(sigma) | Specifies that the entropy dual and gradient should be computed with a quadratic penalty term on magnitude of the parameters. |