scipy.maxentropy.conditionalmodel.fit

conditionalmodel.fit(algorithm='CG')

Fits the conditional maximum entropy model subject to the constraints

sum_{w, x} p_tilde(w) p(x | w) f_i(w, x) = k_i
for i=1,...,m, where k_i is the empirical expectation
k_i = sum_{w, x} p_tilde(w, x) f_i(w, x).