Games automata play

Angluin's style learning for weighted automata

April 13, 2018 | by Nathanaël Fijalkow

We show that weighted automata over the reals can be learned efficiently in Angluin's supervised scenario.

This post uses all the notations of the previous post, and the result presented here was proved in this paper.

The scenario is Angluin’s style learning: a master knows a function , and can answer two types of queries.

  • membership query: when asked about $w \in \Sigma^*$, the master replies with
  • equivalence query: when asked whether $f = \A$ for a given weighted automaton, the master replies YES or gives a counter-example.

Theorem: (Beimel, Bergadano, Bshouty, Kushilevitz, Varricchio, 2000) Weighted automata are efficiently learnable using a perfect teacher.

The algorithm maintains a set of rows with and a set of columns with such that

  • $X$ and $Y$ have the same size,
  • the matrix guaranteed to have full rank.

The first question is how to initialise the data, and then how to maintain it. For initialisation, start with an equivalence query asking whether the function is identically zero. The master replies with a counter-example $y$, and we can construct the data for by asking a membership query for . This matrix has rank $1$.

We now explain how to extend the data. This goes in two steps:

  • constructing an automaton and submitting it to the master,
  • expanding the matrix using the counter-example given by the master.

We construct a hypothesis automaton. The first step is to fill in using at most membership queries. The automaton is as follows.

  • The set of states is .
  • The initial vector is .
  • The transition is defined to satisfy , i.e. .
  • The final vector is .

Note that we do not claim that this automaton satisfies for . (Thanks Jérôme Leroux for the question! One can find counter-examples to this claim: over a one-letter alphabet: with and .)

We submit to the master, and assume that we get in return a word $z$ such that .

We say that a word $w$ is correct if .

We observe that $\varepsilon$ is correct and that $z$ is not correct, since this would imply .

Let $w$ such that $w$ is correct and $aw$ is not correct. Such a word can be detected by querying the suffixes of $z$ of increasing length, thanks to the two observations above.

By definition $w$ is correct:


And $aw$ is not correct, so there exists $x \in X$ such that


Lemma: has full rank.

Since $H_f(X,Y)$ has full rank, it is enough to show that the last column is linearly independent from the others. Assume towards contradiction that this is not the case, there exists $\lambda \in \R^Y$ such that .

This implies

Instantiating in $x$ we get , a contradiction with $aw$ being not correct.

Note that the lemma implies that $xa \notin X$ and $w \notin Y$, so we do maintain that the size of $X$ and $Y$ are equal.

How long does the algorithm run?

Let $n = \rk(H_f)$, we claim that the automaton computed when $X$ and $Y$ have size $n$ does compute . Indeed, if it did not, then we could extend $X$ and $Y$ as the algorithm does, obtaining a submatrix of $H_f$ of rank $n+1$, which is impossible. It follows that the total number of queries is:

  • exactly $n-1$ equivalence queries,
  • $O(n^3)$ membership queries.

Note that the algorithm we presented here is based on the construction of the backward automaton (see the previous post). A dual algorithm can be constructed using the forward automaton, which is actually what is done in the original paper.