Implement the algorithm in Beimel, Amos, et al. "Learning functions represented as multiplicity automata." Journal of the ACM (JACM) 47.3 (2000): 506-530.