Learning/Knowledge in Learning

Lesson 5.71,692 words

Knowledge in Learning

Pure induction learns a function from labelled examples while knowing almost nothing to begin with. This first part brings prior knowledge into the loop by recasting learning as logical inference — hypotheses, examples, and classifications as sentences.

╌╌╌╌

Learning from examples starts from almost nothing. A decision-tree learner assumes only a rough form for its hypotheses — some tree over these attributes — plus a mild preference for simplicity, and then searches. Before it can learn anything new it must, in effect, forget everything it knows. That is a strange way for an intelligent agent to operate. A traveler who hears one Brazilian speak Portuguese concludes that Brazilians speak Portuguese, but does not conclude that all Brazilians are named Fernando on learning the speaker's name. The difference is prior knowledge: she already knows that nationality tends to fix language but not personal names.

This lesson studies learning that takes advantage of prior knowledge about the world, usually represented as general first-order logical theories. For the first time we bring knowledge representation and learning together. The benefit is twofold: knowledge makes learning faster (fewer examples suffice), and it makes learning richer (relational hypotheses that no attribute-based method can even express).

A logical formulation of learning

To let knowledge participate, we first rebuild induction inside logic. Each example is described by a logical sentence. Attributes become unary predicates, so the first restaurant example (from the decision-tree lesson) reads

Write for the whole description of . The classification is a literal in the goal predicate: or . Every hypothesis has the form

where the candidate definition is some expression over the attribute predicates. A decision tree is one such sentence. The set of examples a hypothesis predicts positive is its extension; two hypotheses with different extensions are logically inconsistent, because they disagree on at least one example. The hypothesis space is all the hypotheses the learner will entertain, and the learner believes the disjunction .

An example is inconsistent with a hypothesis in one of two ways. It is a false negative if the hypothesis says negative but the example is positive, and a false positive if the hypothesis says positive but the example is negative. In either case the example and hypothesis are logically inconsistent, so — assuming the example is a correct observation — the hypothesis can be ruled out. Behind that elimination sits the resolution rule: an inconsistent example resolves against a disjunct of the hypothesis space, deleting it. Induction becomes the gradual elimination of hypotheses inconsistent with the data.

Enumerating and resolving over a vast (or infinite) hypothesis space by theorem proving is impractical. Two efficient strategies find consistent hypotheses with much less effort.

Keep a single hypothesis and patch it as examples arrive. When a false negative appears, the hypothesis is too narrow, so we generalize its extension to admit the new positive. When a false positive appears, the hypothesis is too broad, so we specialize its extension to exclude the new negative. A consistent example requires no action.

Current-best-hypothesis search shown as an extension (rectangle) over examples marked and . A false negative (circled outside) forces a generalization that grows the region; a false positive (circled inside) forces a specialization that shrinks it.

Both moves also have a purely logical reading, and that is what lets a program carry them out. If hypothesis with definition generalizes with definition , then . So to generalize , find a logically implied by . The simplest way is dropping conditions: if is , dropping the first conjunct gives the weaker , which admits more positives. Specialization is the mirror image: add a conjunct, or drop a disjunct.

A worked trace on the restaurant data shows the mechanics. The hypothesis is adjusted example by example:

  • (positive): holds, so start with .
  • (negative): predicts positive — a false positive. Specialize by adding a conjunct: .
  • (positive): predicts negative — a false negative. Generalize by dropping : .
  • (positive): false negative again. We cannot drop (that would readmit ), so add a disjunct: .

The algorithm is nondeterministic: at each step several generalizations or specializations may apply, and a greedy choice can paint the search into a corner where no local repair restores consistency. Then it must backtrack to an earlier choice point.

Algorithm:Current-Best-Learning(examples,h)\textsc{Current-Best-Learning}(examples, h) — maintain and repair one hypothesis
  1. 1
    input: a set of examplesexamples, a current hypothesis hh
  2. 2
    if examplesexamples is empty then
  3. 3
    return hh
  4. 4
    ee \gets first of examplesexamples
  5. 5
    if ee is consistent with hh then
  6. 6
    return Current-Best-Learning(rest(examples),h)\textsc{Current-Best-Learning}(rest(examples), h)
  7. 7
    else if ee is a false positive for hh then
  8. 8
    for each hh' in specializations of hh consistent with examplesexamples seen so far do
  9. 9
    hCurrent-Best-Learning(rest(examples),h)h'' \gets \textsc{Current-Best-Learning}(rest(examples), h')
  10. 10
    if hfailh'' \ne fail then return hh''
  11. 11
    else if ee is a false negative for hh then
  12. 12
    for each hh' in generalizations of hh consistent with examplesexamples seen so far do
  13. 13
    hCurrent-Best-Learning(rest(examples),h)h'' \gets \textsc{Current-Best-Learning}(rest(examples), h')
  14. 14
    if hfailh'' \ne fail then return hh''
  15. 15
    return failfail

Two costs bite as data grows: every repair rechecks all previous examples, and the backtracking search can wander through a doubly-exponential hypothesis space.

Least-commitment search and the version space

Backtracking arises because current-best-hypothesis commits to one guess too soon. The least-commitment alternative keeps all hypotheses consistent with the data so far, never choosing among them. As inconsistent hypotheses are pruned from the disjunction , the surviving set — assuming the true hypothesis is in — still contains the right answer, because only incorrect hypotheses were removed. This surviving set is the version space, and the algorithm that maintains it is candidate elimination.

The version space can be astronomically large, so we never list it. Instead we exploit the generalization ordering, just as one represents all reals in by the two endpoints. The version space is bounded by two boundary sets: the G-set, its most general members, and the S-set, its most specific members. Everything between the two boundaries is guaranteed consistent.

The version space bounded by a most-general G-set and a most-specific S-set. Every hypothesis between the two boundaries is consistent; the shaded regions above and below are all inconsistent.

The initial version space represents every hypothesis: set the G-set to (everything is positive) and the S-set to (nothing is). The step retains only hypotheses consistent with each new example ; the boundaries are moved by four cases, one per boundary member or that the new example makes inconsistent:

  • False positive for : is too general, and by definition has no consistent specialization, so remove it from the S-set.
  • False negative for : is too specific; replace it by its immediate generalizations that are still more specific than some member of .
  • False positive for : is too general; replace it by its immediate specializations that are still more general than some member of .
  • False negative for : is too specific, has no consistent generalization, so remove it from the G-set.
The candidate-elimination update. A new example may be a false positive or false negative for a boundary member; each of the four cases either deletes it or replaces it by immediate neighbors that stay inside the opposite boundary.

The process runs until one of three things happens: exactly one hypothesis remains (return it); the version space collapses — S or G becomes empty, meaning no consistent hypothesis exists, the analogue of the decision-tree learner's failure; or examples run out with several hypotheses left, in which case the version space represents a disjunction and a new example is classified by majority vote of the survivors when they disagree.

A worked candidate-elimination trace

Track the two boundaries through a worked run. Objects have two attributes, and , and a hypothesis is a conjunction of attribute constraints, each either a fixed value or a wildcard ? that matches anything. The most specific hypothesis is (matches nothing) and the most general is (matches everything). Initialize and .

  • Example 1: , positive. A positive example is a false negative for the too-specific , so generalize minimally to cover it: . already covers it, so is unchanged.
  • Example 2: , positive. Again a false negative for . The minimal generalization of that admits a large object drops the constraint: . still covers it.
  • Example 3: , negative. This is a false positive for , which is too general. Specialize to exclude the blue negative while staying more general than . Adding works; adding does not, because is not more general than . So .

Now and coincide at : the version space has collapsed to a single hypothesis, the concept is red things, learned from three examples without ever enumerating the hypothesis space. Had the third example been positive instead, would have generalized to , matching , and the concept would have been anything — the boundaries always squeeze toward each other from opposite sides.

The candidate-elimination trace. S climbs from the empty concept up to (?, red) as positives arrive; G descends from (?, ?) down to (?, red) when the blue negative arrives. The boundaries meet, collapsing the version space to one concept.

Version-space learning is fragile in practice. With noise or too few attributes for exact classification the space always collapses. If unlimited disjunction is allowed, the S-set degenerates to a single hypothesis — the disjunction of all positive descriptions — and the G-set to the negation of all negative descriptions, so nothing is really generalized. And for some hypothesis spaces the boundary sets grow exponentially in the number of attributes. Still, the pure version-space method produced the first genuinely novel scientific knowledge generated by a program, in the Meta-DENDRAL system, which learned mass-spectrometry rules worth publishing.

How prior knowledge changes learning

To bring knowledge in, name the pieces. Let be the conjunction of all example descriptions and the conjunction of all their goal literals. A that explains the observations must satisfy the entailment constraint (with read logically entails):

Pure inductive learning solves this for , drawn from a fixed hypothesis space. Add knowledge and the setting changes: the agent already knows something and is trying to learn more. Learning becomes cumulative — the agent's stock of background knowledge grows over its lifetime, and each new episode both uses and adds to it.

Cumulative, knowledge-based inductive learning. Observations and the current background knowledge feed the learner, which outputs hypotheses that both drive predictions and are folded back into the background knowledge.

Prior knowledge shows up in three distinct roles, each a different entailment constraint. The traveler generalizes about language from one Brazilian; the caveman watching Zog toast a lizard on a stick generalizes a principle of painless cooking from one demonstration; the medical student infers a drug's effect from one consultation. These are not pure induction — the background knowledge does real work, and the shape of that work differs.

Three ways prior knowledge enters learning, ordered by how much the hypothesis contributes. In EBL the background alone entails the hypothesis; in RBL relevance plus data entail it deductively; in KBIL the hypothesis is genuinely new, and background plus hypothesis together explain the data.

Each of the three roles corresponds to a distinct learning method with its own algorithm. Explanation-based learning turns background knowledge into speed, relevance-based learning turns determinations into a smaller search, and inductive logic programming learns genuinely new first-order theories. Those three methods continue in Knowledge-Based Learning: EBL, Relevance, and ILP.

╌╌ END ╌╌