ArticleslgStudy

computer science

Characteristic samples

Characteristic samples is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Characteristic samples rather than just read about it. In short: 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.

Key takeaways

  • Characteristic samples belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Characteristic samples to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Characteristic samples from memory before moving on to harder problems.

Reference excerpt

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.

Worked examples

Example 1 — a first encounter with Characteristic samples

Start with the simplest possible case. Write down what Characteristic samples claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Characteristic samples before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Characteristic samples ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Characteristic samples

In research
Characteristic samples appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Characteristic samples in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Characteristic samples is common in secondary-school and first-year university syllabi. It links to neighbouring topics Machine learning algorithms, so understanding it makes those chapters shorter.
In everyday life
Look for Characteristic samples outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Characteristic samples” →

How to study Characteristic samples in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Characteristic samples means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Characteristic samples out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Characteristic samples in simple terms?

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.

Why does Characteristic samples matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Characteristic samples?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Characteristic samples.

Tags

  • Machine learning algorithms

Keep exploring