Characteristic samples explained

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\inL

l(s)=-1

if and only if

s\notinL

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

C

and a class of representations for the languages

R

, the paradigm goes as follows:

A

selects a language

L\inC

and reports it to 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

I

gets the sample and computes a representation

R\inR

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)\in\{-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)=1ifandonlyifs\inL

l(s)=-1ifandonlyifs\notinL

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

.

D

that is consistent with

L

and also fulfils

S\subseteqD

,

I

's output on

D

is a representation

R

that recognizes

L

.

A Class of languages

C

is said to have charistaristic samples if every

L\inC

has a characteristic sample.

Related Theorems

Theorem

If equivalence is undecidable for a class \mathbb over \Sigma of cardinality bigger than 1, then \mathbb doesn't have characteristic samples.[1]

Proof

Given a class of representations \mathbb such that equivalence is undecidable, for every polynomial

p(x)

and every

n\inN

, 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 \mathbb 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\cupS2

, 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.[2]

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,

\simL

(where

x\simLy

for

x,y\in\Sigma*

if and only if

\forallz\in\Sigma*:xz\inL\leftrightarrowyz\inL

). Note that if

x

,

y

are not congruent with respect to

\simL

, there exists a string

z

such that

xz\inL

but

yz\notinL

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\inWS\cupW\SigmaS\}

where

l(w)

is the correct lable of

w

(whether it is in

L

or not). We may assume that

\epsilon\inS

.

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

:
  1. If

pisj\inWMij=l(pisj)

  1. else,

Mij=0

Now, we say row

i

and

t

are distinguishable if there exists an index

j

such that

Mij=-1 x Mtj

. The next stage of the inference algorithm is to construct the set

Q

of distinguishable rows in

M

, by initializing

Q

with

\epsilon

and iterating from the first row of

M

downwards and doing the following for row

ri

:
  1. If

ri

is distinguishable from all elements in

Q

, add it to

Q

  1. 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\inQ

and every

\sigma\in\Sigma

, the row

s\sigma

exists in

M

, and from the construction of

Q

, there exists a row

s'\inQ

such that

s'

and

s\sigma

are indistinguishable. The output automaton will be defined as follows:

Q

.

\epsilon\inQ

.

\{s\inQ|l(s)=1\}

.

\delta(s,\sigma)=s'

, where

s'

is the element in

Q

that is indistinguishable from

s\sigma

.

Other polynomially characterizable classes

Non polynomially characterizable classes

There are some classes that do not have polynomially sized characteristic samples. For example, from the first theorem in the Related theorems segment, it has been shown that the following classes of languages do not have polynomial sized characteristic samples:

CFG

- The class of context-free grammars Languages over

\Sigma

of cardinality larger than

1

LING

- The class of linear grammar languages over

\Sigma

of cardinality larger than

1

SDG

- The class of simple deterministic grammars Languages

NFA

- The class of nondeterministic finite automata Languages

Relations to other learning paradigms

Classes of representations that has characteristic samples relates to the following learning paradigms:

Class of semi-poly teachable languages

A representation class

C

is semi-poly

T/L

teachable if there exist 3 polynomials

p,q,r

, a teacher

T

and an inference algorithm

I

, such that for any adversary

A

the following holds:

A

Selects a representation

R

of size

n

from

C

T

computes a sample that is consistent with the language that

R

recognize, of size bounded by

p(n)

and the strings in the sample bounded by length

q(n)

A

adds correctly labeled strings to the sample computed by

T

, making the new sample of size

m

I

then computes a representation equivalent to

R

in time bounded by

r(m)

The class of languages that there exists a polynomial algorithm that given a sample, returns a representation consistent with the sample is called consistency easy.

Polynomially characterizable languages

Given a representation class

R

, and

l{I}

a set of identification algorithms for

R

,

R

is polynomially characterizable for

l{I}

if any

R\inR

has a characteristic sample of size polynomial of

R

's size,

S

, that for every

I\inl{I}

,

I

's output on

S

is

R

.

Releations between the paradigms

Theorem

A consistency-easy class

C

has characteristic samples if and only if it is semi-poly

T/L

teachable.
Proof

Assuming

C

has characteristic samples, then for every representation

R\inC

, its characteristic sample

S

holds the conditions for the sample computaed by the teacher, and the output of

I

on every sample

S'

such that

S\subseteqS'

is equivalent to

R

from the definition of characteristic sample.

Assuming that

C

is semi-poly

T/L

teachable, then for every representation

R\inC

, the computed sample by the teacher

S

is a characteristic sample for

R

.

Theorem

If

C

has characteristic sample, then

C

is polynomially characterizable.
Proof

Assuming falsely that

C

is not polynomially characterizable, there are two non equivalent representations

R1,R2\inC

, with characteristic samples

S1

and

S2

respectively. From the definition of characteristic samples, any inference algorithm

I

need to infer from the sample

S1\cupS2

a representation compatible with

R1

and

R2

, in contradiction.

See also

References

  1. De La Higuera . Colin . 1997 . [No title found] ]. Machine Learning . 27 . 2 . 125–138 . 10.1023/A:1007353007695.
  2. Goldman . Sally A. . Mathias . H.David . April 1996 . Teaching a Smarter Learner . Journal of Computer and System Sciences . 52 . 2 . 255–267 . 10.1006/jcss.1996.0020 . 0022-0000.
  3. Beimel . Amos . Bergadano . Francesco . Bshouty . Nader H. . Kushilevitz . Eyal . Varricchio . Stefano . May 2000 . Learning functions represented as multiplicity automata . Journal of the ACM . 47 . 3 . 506–530 . 10.1145/337244.337257 . 0004-5411.
  4. Book: Burago, Andrey . Learning structurally reversible context-free grammars from queries and counterexamples in polynomial time . 1994 . 140–146 . Proceedings of the seventh annual conference on Computational learning theory - COLT '94 . http://dx.doi.org/10.1145/180139.181075 . New York, New York, USA . ACM Press . 10.1145/180139.181075. 0-89791-655-7 .
  5. Book: Berman . Piotr . Roos . Robert . Learning one-counter languages in polynomial time . October 1987 . 28th Annual Symposium on Foundations of Computer Science (SFCS 1987) . http://dx.doi.org/10.1109/sfcs.1987.36 . 61–67 . IEEE . 10.1109/sfcs.1987.36. 0-8186-0807-2 .