CS307
Machine Learning
Lecture 8
Concept Learning
Krishnendu Ghosh
Department of Computer Science & Engineering
Indian Institute of Information Technology Dharwad
Source: Chapter 1&2 from Tom Mitchell
WELL-POSED LEARNING PROBLEMS
A computer program is said to learn from experience E with respect to some class of tasks T and performance measure P, if its performance at tasks in T, as measured by P, improves with experience E.
A checkers learning problem:
Task T: playing checkers
Performance measure P: percent of games won against opponents
Training experience E: playing practice games against itself
2
DESIGNING A LEARNING SYSTEM
Choosing the Training Experience
One key attribute is whether the training experience provides direct or indirect feedback regarding the choices made by the performance system.
credit assignment
3
DESIGNING A LEARNING SYSTEM
Choosing the Training Experience
A second important attribute of the training experience is the degree to which
the learner controls the sequence of training examples.
4
DESIGNING A LEARNING SYSTEM
Choosing the Training Experience
A third important attribute of the training experience is how well it represents the distribution of examples over which the final system performance P must be measured.
5
DESIGNING A LEARNING SYSTEM
A checkers learning problem:
Task T: playing checkers
Performance measure P: percent of games won in the world tournament
Training experience E: games played against itself
In order to complete the design of the learning system, we must now choose
1. the exact type of knowledge to be learned
2. a representation for this target knowledge
3. a learning mechanism
6
DESIGNING A LEARNING SYSTEM
Choosing the Target Function
Given this setting where we must learn to choose among the legal moves, the most obvious choice for the type of information to be learned is a program, or function, that chooses the best move for any given board state.
Let us call this function ChooseMove and use the notation ChooseMove : B -> M to indicate that this function accepts as input any board from the set of legal board states B and produces as output some move from the set of legal moves M.
7
DESIGNING A LEARNING SYSTEM
Choosing the Target Function
An alternative target function and one that will turn out to be easier to learn in this setting is an evaluation function that assigns a numerical score to any given board state.
Let us call this target function V and again use the notation V : B -> ℜ to denote that V maps any legal board state from the set B to some real value.
8
DESIGNING A LEARNING SYSTEM
Let us therefore define the target value V(b) for an arbitrary board state b in B:
nonoperational definition
9
DESIGNING A LEARNING SYSTEM
The goal of learning in this case is to discover an operational description of V; that is, a description that can be used by the checkers-playing program to evaluate states and select moves within realistic time bounds.
Thus, we have reduced the learning task in this case to the problem of discovering an operational description of the ideal target function V. In fact, we often expect learning algorithms to acquire only some approximation to the target function, and for this reason the process of learning the target function is often called function approximation.
10
DESIGNING A LEARNING SYSTEM
Choosing a Representation for the Target Function
Now that we have specified the ideal target function V, we must choose a representation that the learning program will use to describe the function that it will learn.
We could, for example, allow the program to represent using a large table with a distinct entry specifying the value for each distinct board state. Or we could allow it to represent using a collection of rules that match against features of the board
state, or a quadratic polynomial function of predefined board features, or an artificial neural network.
11
DESIGNING A LEARNING SYSTEM
Choosing a Representation for the Target Function
To keep the discussion brief, let us choose a simple representation:
for any given board state, the function will be calculated as a linear combination
of the following board features:
12
DESIGNING A LEARNING SYSTEM
Choosing a Representation for the Target Function
Thus, our learning program will represent V^(b) as a linear function of the form
V^(b) = w0 + w1x1 + w2x2 + w3x3 + w4x4 + w5x5 + w6x6
where wo through w6 are numerical coefficients, or weights, to be chosen by the learning algorithm. Learned values for the weights w1 through w6 will determine the relative importance of the various board features in determining the value of the board, whereas the weight w0 will provide an additive constant to the board value.
13
DESIGNING A LEARNING SYSTEM
Partial design of a checkers learning program:
Task T: playing checkers
Performance measure P : percent of games won in the world tournament
Training experience E: games played against itself
Target function: V : B -> ℜ
Target function representation:
V^(b) = w0 + w1x1 + w2x2 + w3x3 + w4x4 + w5x5 + w6x6
14
DESIGNING A LEARNING SYSTEM
Choosing a Function Approximation Algorithm
In order to learn the target function V^ we require a set of training examples, each describing a specific board state b and the training value Vtrain(b) for b. In other words, each training example is an ordered pair of the form <b, Vtrain(b)>
For instance, the following training example describes a board state b in which black has won the game (note x2 = 0 indicates that red has no remaining pieces) and for which the target function value Vtrain(b) is therefore +100.
< <x1=3,x2=0,x3=1,x4=0,x5=0,x6=0 , +100 >
15
DESIGNING A LEARNING SYSTEM
Estimating Training Values
Vtrain(b) -> V^successor(b)
Adjusting Weights
E ≣ ∑b Vtrain(b)2 - V^(b)2
wi = wi + 𝜂 (Vtrain(b) - V^(b)) xi
16
DESIGNING A LEARNING SYSTEM
The Final Design
17
DESIGNING A LEARNING SYSTEM
18
PERSPECTIVES AND ISSUES
Issues in Machine Learning
What algorithms exist for learning general target functions from specific training examples? In what settings will particular algorithms converge to the desired function, given sufficient training data? Which algorithms perform best for which types of problems and representations?
How much training data is sufficient? What general bounds can be found to relate the confidence in learned hypotheses to the amount of training experience and the character of the learner's hypothesis space?
19
PERSPECTIVES AND ISSUES
Issues in Machine Learning
When and how can prior knowledge held by the learner guide the process of generalizing from examples? Can prior knowledge be helpful even when it is only approximately correct?
What is the best strategy for choosing a useful next training experience, and how does the choice of this strategy alter the complexity of the learning problem?
What is the best way to reduce the learning task to one or more function approximation problems? Put another way, what specific functions should the system attempt to learn? Can this process itself be automated?
How can the learner automatically alter its representation to improve its ability to represent and learn the target function?
20
A CONCEPT LEARNING TASK
Consider the example task of learning the target concept "days on which my friend Aldo enjoys his favorite watersport."
The attribute EnjoySport indicates whether or not Aldo enjoys his favorite water sport on this day. The task is to learn to predict the value of EnjoySport for an arbitrary day, based on the values of its other attributes.
21
A CONCEPT LEARNING TASK
In particular, let each hypothesis be a vector of six constraints, specifying the values of the six attributes Sky, AirTemp, Humidity, Wind, Water, and Forecast.
For each attribute, the hypothesis will either
To illustrate, the hypothesis that Aldo enjoys his favorite sport only on cold days with high humidity (independent of the values of the other attributes) is represented by the expression
<?, Cold, High, ?, ?, ?>
22
A CONCEPT LEARNING TASK
The most general hypothesis-that sented by every day is a positive example is represented by <?, ?, ?, ?, ?, ?>
The most specific possible hypothesis that represented by no day is a positive example is represented by <𝜙,𝜙,𝜙,𝜙,𝜙,𝜙>
23
A CONCEPT LEARNING TASK
Notation
24
A CONCEPT LEARNING TASK
Given a set of training examples of the target concept c, the problem faced
by the learner is to hypothesize, or estimate, c. We use the symbol H to denote
the set of all possible hypotheses that the learner may consider regarding the
identity of the target concept.
In general, each hypothesis h in H represents a boolean-valued function defined over X; that is, h : X -> {0,1). The goal of the learner is to find a hypothesis h such that h(x) = c(x) for all x in X.
25
A CONCEPT LEARNING TASK
The Inductive Learning Hypothesis
Any hypothesis found to approximate the target function well over a sufficiently large set of training examples will also approximate the target function well over other unobserved examples.
26
CONCEPT LEARNING AS SEARCH
Consider, for example, the instances X and hypotheses H in the EnjoySport learning task. Given that the attribute Sky has three possible values, and that AirTemp, Humidity, Wind, Water, and Forecast each have two possible values, the instance space X contains exactly 3 . 2 . 2 . 2 . 2 . 2 = 96 distinct instances. A similar calculation shows that there are 5 . 4 . 4 . 4 . 4 . 4 = 5120 syntactically distinct hypotheses within H. Notice, however, that every hypothesis containing one or more "𝜙" symbols represents the empty set of instances; that is, it classifies every instance as negative. Therefore, the number of semantically distinct hypotheses is only 1 + ( 4 . 3 . 3 . 3 . 3 . 3 ) = 973.
27
CONCEPT LEARNING AS SEARCH
Let's break this down carefully.
1. Instance Space Calculation
Each instance in X is defined by six attributes:
The total number of distinct instances in X is calculated as:
3×2×2×2×2×2=96
28
CONCEPT LEARNING AS SEARCH
2. Syntactically Distinct Hypotheses in H
Each hypothesis in H is a conjunction of constraints over the six attributes. The constraints on each attribute can be:
29
CONCEPT LEARNING AS SEARCH
Counting the possibilities for each attribute:
Thus, the total number of syntactically distinct hypotheses is:
5×4×4×4×4×4=5120
30
CONCEPT LEARNING AS SEARCH
3. Semantically Distinct Hypotheses
Some hypotheses are equivalent in meaning. Specifically:
31
CONCEPT LEARNING AS SEARCH
Removing redundant hypotheses:
To count semantically distinct hypotheses, we consider:
Thus, the number of semantically distinct hypotheses is:
1+(4×3×3×3×3×3)=1+972=973
32
CONCEPT LEARNING AS SEARCH
General-to-Specific Ordering of Hypotheses
To illustrate the general-to-specific ordering, consider the two hypotheses
h1 = >Sunny, ?, ?, Strong, ?, ?>
h2 = <Sunny, ?, ?, ?, ?, ?>
Now consider the sets of instances that are classified positive by h1 and by h2.
Because h2 imposes fewer constraints on the instance, it classifies more instances as positive. In fact, any instance classified positive by h1 will also be classified positive by h2. Therefore, we say that h2 is more general than h1.
33
CONCEPT LEARNING AS SEARCH
General-to-Specific Ordering of Hypotheses
First, for any instance x in X and hypothesis h in H, we say that x satisfies h if and only if h(x) = 1. We now define the more-general-than or equal-to relation in terms of the sets of instances that satisfy the two hypotheses: Given hypotheses hj and hk, hj is more-general-than m equal do hk if and only if any instance that satisfies hk also satisfies hi.
Definition: Let hj and hk be boolean-valued functions defined over X. Then hj is
more general-than-or-equal-to hk (written hj >=g hk ) if and only if
(for all x in X) [ (hk(x) = 1) -> (hj(x) = 1) ]
34
CONCEPT LEARNING AS SEARCH
General-to-Specific Ordering of Hypotheses
35
FIND-S: FINDING A MAXIMALLY SPECIFIC HYPOTHESIS
FIND-S Algorithm
36
FIND-S: FINDING A MAXIMALLY SPECIFIC HYPOTHESIS
FIND-S Algorithm
The first step of FIND-S is to initialize h to the most specific hypothesis in H
h <- <𝜙,𝜙,𝜙,𝜙,𝜙,𝜙>
Upon observing the first training example, which happens to be a positive example, it becomes clear that our hypothesis is too specific.
h <- <Sunny, Warm, Normal, Strong, Warm, Same>
37
FIND-S: FINDING A MAXIMALLY SPECIFIC HYPOTHESIS
FIND-S Algorithm
Next, the second training example (also positive in this case) forces the algorithm to further generalize h, this time substituting a "?' in place of any attribute value in h that is not satisfied by the new example.
h <- <Sunny, Warm, ?, Strong, Warm, Same>
38
FIND-S: FINDING A MAXIMALLY SPECIFIC HYPOTHESIS
FIND-S Algorithm
Upon encountering the third training example-in this case a negative example the algorithm makes no change to h.
h <- <Sunny, Warm, ?, Strong, Warm, Same>
In fact, the FIND-S algorithm simply ignores every negative example!
39
FIND-S: FINDING A MAXIMALLY SPECIFIC HYPOTHESIS
FIND-S Algorithm
To complete our trace of FIND-S, the fourth (positive) example leads to a further generalization of h
h <- <Sunny, Warm, ?, Strong, ?, ?>
40
FIND-S: FINDING A MAXIMALLY SPECIFIC HYPOTHESIS
FIND-S Algorithm
41
FIND-S: FINDING A MAXIMALLY SPECIFIC HYPOTHESIS
FIND-S Algorithm
At each step, the hypothesis is generalized only as far as necessary to cover the new positive example. Therefore, at each stage the hypothesis is the most specific hypothesis consistent with the training examples observed up to this point (hence the name FIND-S)
42
FIND-S: FINDING A MAXIMALLY SPECIFIC HYPOTHESIS
FIND-S Algorithm
The key property of the FIND-S algorithm is that for hypothesis spaces described by conjunctions of attribute constraints (such as H for the EnjoySport task), FIND-S is guaranteed to output the most specific hypothesis within H that is consistent with the positive training examples.
Its final hypothesis will also be consistent with the negative examples provided the correct target concept is contained in H, and provided the training examples are correct.
43
CANDIDATE-ELIMINATION ALGORITHM
The key idea in the CANDIDATE-ELIMINATION algorithm is to output a description of the set of all hypotheses consistent with the algorithm computes the training examples.
44
CANDIDATE-ELIMINATION ALGORITHM
Representation
Definition: A hypothesis h is consistent with a set of training examples D if and
only if h(x) = c(x) for each example <x, c(x) > in D.
45
CANDIDATE-ELIMINATION ALGORITHM
Representation
Definition: The version space, denoted VSH,D with, respect to hypothesis space H and training examples D, is the subset of hypotheses from H consistent with the training examples in D.
46
CANDIDATE-ELIMINATION ALGORITHM
The LIST-THEN-ELIMINATE Algorithm
47
CANDIDATE-ELIMINATION ALGORITHM
A More Compact Representation for Version Spaces
Definition: The general boundary G, with respect to hypothesis space H and training data D, is the set of maximally general members of H consistent with D.
Definition: The specific boundary S, with respect to hypothesis space H and training data D, is the set of minimally general (i.e., maximally specific) members of H consistent with D.
48
CANDIDATE-ELIMINATION ALGORITHM
A More Compact Representation for Version Spaces
49
CANDIDATE-ELIMINATION ALGORITHM
It begins by initializing the version space to the set of all hypotheses in H; that is, by initializing the G boundary set to contain the most general hypothesis in H
G0 : <?, ?, ?, ?, ?, ?>
and initializing the S boundary set to contain the most specific (least general) hypothesis
S0 : <𝜙, 𝜙, 𝜙, 𝜙, 𝜙, 𝜙>
50
CANDIDATE-ELIMINATION ALGORITHM
51
CANDIDATE-ELIMINATION ALGORITHM
52
CANDIDATE-ELIMINATION ALGORITHM
53
CANDIDATE-ELIMINATION ALGORITHM
54
CANDIDATE-ELIMINATION ALGORITHM
55
Thank You
56