def f0(x): return x in samplespace def f1(x): return x == 'dans' or x == 'en' def f2(x): return x == 'dans' or x == a_grave f = [f0, f1, f2] model = maxentropy.Model(f, samplespace, vectorized=False) # Now set the desired feature expectations K = [1.0, 0.3, 0.5] model.verbose = True # Fit the model model.fit(K) # Output the distribution print("\nFitted model parameters are:\n" + str(model.params)) print("\nFitted distribution is:") p = model.probdist() for j in range(len(model.samplespace)): x = model.samplespace[j]
def f0(x): return x in samplespace def f1(x): return x == 'dans' or x == 'en' def f2(x): return x == 'dans' or x == a_grave f = [f0, f1, f2] model = maxentropy.Model(f, samplespace) # Now set the desired feature expectations K = [1.0, 0.3, 0.5] model.verbose = True # Fit the model model.fit(K) # Output the distribution print("\nFitted model parameters are:\n" + str(model.params)) print("\nFitted distribution is:") p = model.probdist() for j in range(len(model.samplespace)): x = model.samplespace[j]