Characteristic samples is a concept in the field of grammatical inference, related to passive learning. In passive learning, an inference algorithm I is given a set of pairs of strings and labels S, and returns a representation R that is consistent with S. Characteristic samples consider the scenario when the goal is not only finding a representation consistent with S, but finding a representation that recognizes a specific target language. A characteristic sample of language L is a set of pairs of the form (s,l(s)) where:
l(s)=1 if and only if s∈L l(s)=−1 if and only if s∉L Given the characteristic sample S, I's output on it is a representation R, e.g. an automaton, that recognizes L.
Formal Definition
The Learning Paradigm associated with Characteristic Samples There are three entities in the learning paradigm connected to characteristic samples, the adversary, the teacher and the inference algorithm. Given a class of languages ℂ and a class of representations for the languages ℝ, the paradigm goes as follows:
The adversary A selects a language L∈ℂ and reports it to the teacher The teacher T then computes a set of strings and label them correctly according to L, trying to make sure that the inference algorithm will compute L The adversary can add correctly labeled words to the set in order to confuse the inference algorithm The inference algorithm I gets the sample and computes a representation R∈ℝ consistent with the sample. The goal is that when the inference algorithm receives a characteristic sample for a language L, or a sample that subsumes a characteristic sample for L, it will return a representation that recognizes exactly the language L.
Sample Sample S is a set of pairs of the form (s,l(s)) such that l(s)∈{−1,1}
Sample consistent with a language We say that a sample S is consistent with language L if for every pair (s,l(s)) in S:
l(s)=1 if and only if s∈L l(s)=−1 if and only if s∉L
Characteristic sample Given an inference algorithm I and a language L, a sample S that is consistent with L is called a characteristic sample of L for I if:
I's output on S is a representation R that recognizes L. For every sample D that is consistent with L and also fulfils S⊆D, I's output on D is a representation R that recognizes L. A Class of languages ℂ is said to have charistaristic samples if every L∈ℂ has a characteristic sample.
Related Theorems
Theorem If equivalence is undecidable for a class ℂ over Σ of cardinality bigger than 1, then ℂ doesn't have characteristic samples.
Proof Given a class of representations ℂ such that equivalence is undecidable, for every polynomial p(x) and every n∈ℕ, there exist two representations r1 and r2 of sizes bounded by n, that recognize different languages but are inseparable by any string of size bounded by p(n). Assuming this is not the case, we can decide if r1 and r2 are equivalent by simulating their run on all strings of size smaller than p(n), contradicting the assumption that equivalence is undecidable.
Theorem If S1 is a characteristic sample for L1 and is also consistent with L2, then every characteristic sample of L2, is inconsistent with L1.
Proof Given a class ℂ that has characteristic samples, let R1 and R2 be representations that recognize L1 and L2 respectively. Under the assumption that there is a characteristic sample for L1, S1 that is also consistent with L2, we'll assume falsely that there exist a characteristic sample for L2, S2 that is consistent with L1. By the definition of characteristic sample, the inference algorithm I must return a representation which recognizes the language if given a sample that subsumes the characteristic sample itself. But for the sample S1∪S2, the answer of the inferring algorithm needs to recognize both L1 and L2, in contradiction.
Theorem If a class is polynomially learnable by example based queries, it is learnable with characteristic samples.
Polynomialy characterizable classes
Regular languages The proof that DFA's are learnable using characteristic samples, relies on the fact that every regular language has a finite number of equivalence classes with respect to the right congruence relation, ∼L (where x∼Ly for x,y∈Σ∗ if and only if ∀z∈Σ∗:xz∈L↔yz∈L). Note that if x, y are not congruent with respect to ∼L, there exists a string z such that xz∈L but yz∉L or vice versa, this string is called a separating suffix.
Constructing a characteristic sample The construction of a characteristic sample for a language L by the teacher goes as follows. Firstly, by running a depth first search on a deterministic automaton A recognizing L, starting from its initial state, we get a suffix closed set of words, W, ordered in shortlex order. From the fact above, we know that for every two states in the automaton, there exists a separating suffix that separates between every two strings that the run of A on them ends in the respective states. We refer to the set of separating suffixes as S. The labeled set (sample) of words the teacher gives the adversary is {(w,l(w))|w∈W⋅S∪W⋅Σ⋅S} where l(w) is the correct label of w (whether it is in L or not). We may assume that ϵ∈S.
Constructing a deterministic automata Given the sample from the adversary W, the construction of the automaton by the inference algorithm I starts with defining P=prefix(W) and S=suffix(W), which are the set of prefixes and suffixes of W respectively. Now the algorithm constructs a matrix M where the elements of P function as the rows, ordered by the shortlex order, and the elements of S function as the columns, ordered by the shortlex order. Next, the cells in the matrix are filled in the following manner for prefix pi and suffix sj:
If pisj∈W→Mij=l(pisj) else, Mij=0 Now, we say row i and t are distinguishable if there exists an index j such that Mij=−1×Mtj. The next stage of the inference algorithm is to construct the set Q of distinguishable rows in M, by initializing Q with ϵ and iterating from the first row of M downwards and doing the following for row ri:
If ri is distinguishable from all elements in Q, add it to Q else, pass on it to the next row From the way the teacher constructed the sample it passed to the adversary, we know that for every s∈Q and every σ∈Σ, the row sσ exists in M, and from the construction of Q, there exists a row s′∈Q such that s′ and sσ are indistinguishable. The output automaton will be defined as follows:
… excerpt ends here. Continue reading the full article.