scipy.maxentropy.model.pmf_function

model.pmf_function(f=None)

Returns the pmf p_theta(x) as a function taking values on the model’s sample space. The returned pmf is defined as:

p_theta(x) = exp(theta.f(x) - log Z)

where theta is the current parameter vector self.params. The returned function p_theta also satisfies

all([p(x) for x in self.samplespace] == pmf()).

The feature statistic f should be a list of functions [f1(),...,fn(x)]. This must be passed unless the model already contains an equivalent attribute ‘model.f’.

Requires that the sample space be discrete and finite, and stored as self.samplespace as a list or array.