"learn()" takes the "state" parameter twice
The "learn()" function in "graph_tool.inference.blockmodel_em" takes the state parameter both implicitly and explicitly. This makes it impossible to run "em_infer()" with "learn_first = True".
Example:
g = collection.data["polbooks"]
state = EMBlockState(g, B=3)
delta, niter = em_infer(state, learn_first = True)
Output:
TypeError Traceback (most recent call last)
<ipython-input-393-b787977162fc> in <module>()
1 g = collection.data["polbooks"]
2 state = EMBlockState(g, B=3)
----> 3 delta, niter = em_infer(state, learn_first = True)
/usr/lib/python3.6/site-packages/graph_tool/inference/blockmodel_em.py in em_infer(state, max_iter, max_e_iter, epsilon, learn_first, verbose)
282
283 if learn_first:
--> 284 state.learn(state, epsilon)
285
286 niter = 0
TypeError: learn() takes from 1 to 2 positional arguments but 3 were given