0% found this document useful (0 votes)
48 views55 pages

Chapter 11

The document discusses machine learning, including defining learning as understanding something in a new way, and constructing programs that improve with experience by defining a task, performance measure, and training experience. It also covers designing a learning system by choosing a target function, representation, and learning algorithm, and gives examples of applying concept learning to classify enjoyable sports days based on weather attributes.

Uploaded by

Javed
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
48 views55 pages

Chapter 11

The document discusses machine learning, including defining learning as understanding something in a new way, and constructing programs that improve with experience by defining a task, performance measure, and training experience. It also covers designing a learning system by choosing a target function, representation, and learning algorithm, and gives examples of applying concept learning to classify enjoyable sports days based on weather attributes.

Uploaded by

Javed
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 55

Machine Learning

Chapter 11
Machine Learning

What is learning?

2
Machine Learning

What is learning?

That is what learning is. You suddenly understand


something you've understood all your life, but in a
new way.
(Doris Lessing 2007 Nobel Prize in Literature)

3
Machine Learning

How to construct programs that automatically


improve with experience.

4
Machine Learning

How to construct programs that automatically


improve with experience.

Learning problem:
Task T
Performance measure P
Training experience E

5
Machine Learning

Chess game:
Task T: playing chess games
Performance measure P: percent of games won against
opponents
Training experience E: playing practice games againts itself

6
Machine Learning

Handwriting recognition:
Task T: recognizing and classifying handwritten words
Performance measure P: percent of words correctly
classified
Training experience E: handwritten words with given
classifications

7
Designing a Learning System

Choosing the training experience:


Direct or indirect feedback
Degree of learner's control
Representative distribution of examples

8
Designing a Learning System

Choosing the target function:


Type of knowledge to be learned
Function approximation

9
Designing a Learning System

Choosing a representation for the target function:


Expressive representation for a close function approximation
Simple representation for simple training data and learning
algorithms

10
Designing a Learning System

Choosing a function approximation algorithm


(learning algorithm)

11
Designing a Learning System

Chess game:
Task T: playing chess games
Performance measure P: percent of games won against
opponents
Training experience E: playing practice games againts itself
Target function: V: Board R

12
Designing a Learning System
Chess game:
Target function representation:
V^(b) = w0 + w1x1 + w2x2 + w3x3 + w4x4 + w5x5 + w6x6

x1: the number of black pieces on the board


x2: the number of red pieces on the board
x3: the number of black kings on the board
x4: the number of red kings on the board
x5: the number of black pieces threatened by red
x6: the number of red pieces threatened by black
13
Designing a Learning System
Chess game:
Function approximation algorithm:
(<x1 = 3, x2 = 0, x3 = 1, x4 = 0, x5 = 0, x6 = 0>, 100)

x1: the number of black pieces on the board


x2: the number of red pieces on the board
x3: the number of black kings on the board
x4: the number of red kings on the board
x5: the number of black pieces threatened by red
x6: the number of red pieces threatened by black
14
Designing a Learning System

What is learning?

15
Designing a Learning System
Learning is an (endless) generalization or induction
process.

16
Designing a Learning System

Experiment
New problem Generator Hypothesis
(initial board) (V^)

Performance
Generalizer
System

Solution trace Training examples


(game history) {(b1, V1), (b2, V2), ...}
Critic

17
Issues in Machine Learning

What learning algorithms to be used?

How much training data is sufficient?

When and how prior knowledge can guide the learning process?

What is the best strategy for choosing a next training experience?

What is the best way to reduce the learning task to one or more
function approximation problems?

How can the learner automatically alter its representation to improve


its learning ability?

18
Example
Experience
Example Sky AirT
emp Humidity Wind Water Forecast EnjoySport

1 Sunny Warm Normal Strong Warm Same eYs

2 Sunny Warm High Strong Warm Same eYs

3 Rainy Cold High Strong Warm Change No

4 Sunny Warm High Strong Cool Change eYs

Low Weak
Prediction
5 Rainy Cold High Strong Warm Change ?
6 Sunny Warm Normal Strong Warm Same ?
7 Sunny Warm Low Strong Cool Same ?
19
Example
Learning problem:
Task T:classifying days on which my friend enjoys water sport
Performance measure P: percent of days correctly classified
Training experience E: days with given attributes and classifications

20
Concept Learning

Inferring a boolean-valued function from training


examples of its input (instances) and output
(classifications).

21
Concept Learning
Learning problem:
Target concept: a subset of the set of instances X
c: X {0, 1}
Target function:
Sky AirT
emp Humidity Wind Water Forecast {Y
es, No}
Hypothesis:
Characteristics of all instances of the concept to be learned
Constraints on instance attributes
h: X {0, 1}

22
Concept Learning
Satisfaction:
h(x) = 1 iff x satisfies all the constraints of h
h(x) = 0 otherwsie

Consistency:
h(x) = c(x) for every instance x of the training examples

Correctness:
h(x) = c(x) for every instance x of X

23
Concept Learning

How to represent a hypothesis function?

24
Concept Learning

Hypothesis representation (constraints on instance attributes):


<Sky,AirT
emp, Humidity, Wind, Water, Forecast>
?: any value is acceptable
single required value
: no value is acceptable

25
Concept Learning

General-to-specific ordering of hypotheses:


hj g h k iff xX: h k(x) = 1 h j(x) = 1

Specific
h1 = <Sunny,?, ?, Strong, ? , ?>
h2 = <Sunny,?, ?, ? , ? , ?>
h1 h3
h3 = <Sunny,?, ?, ? , Cool, ?>
Lattice
(Partial order) h2

General
H
26
FIND-S
Example Sky AirT
emp Humidity Wind Water Forecast EnjoySport

1 Sunny Warm Normal Strong Warm Same eYs

2 Sunny Warm High Strong Warm Same eYs

3 Rainy Cold High Strong Warm Change No

4 Sunny Warm High Strong Cool Change eYs

h=< , , , , , >
h = <Sunny,Warm, Normal, Strong, Warm, Same>
h = <Sunny,Warm, ? , Strong, Warm, Same>
h = <Sunny,Warm, ? , Strong, ? , ? >
27
FIND-S

Initialize h to the most specific hypothesis in H:


For each positive training instance x:
For each attribute constraint a i in h:
If the constraint is not satisfied by x
Then replace a i by the next more general
constraint satisfied by x
Output hypothesis h

28
FIND-S
Example Sky AirT
emp Humidity Wind Water Forecast EnjoySport

1 Sunny Warm Normal Strong Warm Same eYs

2 Sunny Warm High Strong Warm Same eYs

3 Rainy Cold High Strong Warm Change No

4 Sunny Warm High Strong Cool Change eYs

h = <Sunny,Warm, ? , Strong, ? , ? >


Prediction
5 Rainy Cold High Strong Warm Change No
6 Sunny Warm Normal Strong Warm Same Yes
7 Sunny Warm Low Strong Cool Same Yes
29
FIND-S

The output hypothesis is the most specific one that


satisfies all positive training examples.

30
FIND-S
The result is consistent with the positive training examples.

31
FIND-S
Is the result is consistent with the negative training examples?

32
FIND-S
Example Sky AirT
emp Humidity Wind Water Forecast EnjoySport

1 Sunny Warm Normal Strong Warm Same eYs

2 Sunny Warm High Strong Warm Same eYs

3 Rainy Cold High Strong Warm Change No

4 Sunny Warm High Strong Cool Change eYs

5 Sunny Warm Normal Strong Cool Change No

h = <Sunny,Warm, ? , Strong, ? , ? >

33
FIND-S
The result is consistent with the negative training examples if
the target concept is contained in H (and the training examples
are correct).

34
FIND-S
The result is consistent with the negative training examples if
the target concept is contained in H (and the training examples
are correct).

Sizes of the space:


Size of the instance space: |X| = 3.2.2.2.2.2 = 96
Size of the concept space C = 2 |X| = 2 96
Size of the hypothesis space H = (4.3.3.3.3.3) + 1 = 973 << 2 96

The target concept (in C) may not be contained in H.

35
FIND-S
Questions:
Has the learner converged to the target concept, as there can be
several consistent hypotheses (with both positive and negative
training examples)?

Why the most specific hypothesis is preferred?

What if there are several maximally specific consistent


hypotheses?

What if the training examples are not correct?

36
List-then-Eliminate Algorithm

Version space: a set of all hypotheses that are consistent


with the training examples.

Algorithm:
Initial version space = set containing every hypothesis in H
For each training example <x, c(x)>, remove from the version space
any hypothesis h for which h(x) c(x)
Output the hypotheses in the version space

37
List-then-Eliminate Algorithm

Requires an exhaustive enumeration of all hypotheses in H

38
Compact Representation of
Version Space

G (the generic boundary): set of the most generic


hypotheses of H consistent with the training data D:

G = {gH | consistent(g, D) gH: gg g consistent(g, D)}

S (the specific boundary): set of the most specific


hypotheses of H consistent with the training data D:

S = {sH | consistent(s, D) sH: s g s consistent(s, D)}

39
Compact Representation of
Version Space
Version space = <G, S> = {hH | gG sS: g g h g s}

40
Candidate-EliminationAlgorithm
Example Sky AirT
emp Humidity Wind Water Forecast EnjoySport
1 Sunny Warm Normal Strong Warm Same eYs
2 Sunny Warm High Strong Warm Same eYs
3 Rainy Cold High Strong Warm Change No
4 Sunny Warm High Strong Cool Change eYs
S0 = {<, , , , , >}
G0 = {<?, ?, ?, ?, ?, ?>}
S
S1 = {<Sunny, Warm, Normal, Strong, Warm, Same>}
G1 = {<?, ?, ?, ?, ?, ?>}

S2 = {<Sunny, Warm, ?, Strong, Warm, Same>}


G2 = {<?, ?, ?, ?, ?, ?>}
G
S3 = {<Sunny, Warm, ?, Strong, Warm, Same>}
G3 = {<Sunny, ?, ?, ?, ?, ?>, <?, Warm, ?, ?, ?, ?>, <?, ?, ?, ?, ?, Same>}

S4 = {<Sunny, Warm, ?, Strong, ?, ?>}


41
G4 = {<Sunny, ?, ?, ?, ?, ?>, <?, Warm, ?, ?, ?, ?>}
Candidate-EliminationAlgorithm
S4 = {<Sunny,Warm, ?, Strong, ?, ?>}

<Sunny,?, ?, Strong, ?, ?> <Sunny,Warm, ?, ?, ?, ?> <?, Warm, ?, Strong, ?, ?>

G4 = {<Sunny,?, ?, ?, ?, ?>, <?, Warm, ?, ?, ?, ?>}

42
Candidate-EliminationAlgorithm

Initialize G to the set of maximally general hypotheses in H

Initialize S to the set of maximally specific hypotheses in H

43
Candidate-EliminationAlgorithm

For each positive example d:


Remove from G any hypothesis inconsistent with d
For each s in S that is inconsistent with d:
Remove s from S
Add to S all least generalizations h of s, such that h is consistent with d
and some hypothesis in G is more general than h
Remove from S any hypothesis that is more general than another
hypothesis in S

44
Candidate-EliminationAlgorithm

For each negative example d:


Remove from S any hypothesis inconsistent with d
For each g in G that is inconsistent with d:
Remove g from G
Add to G all least specializations h of g, such that h is consistent with d
and some hypothesis in S is more specific than h
Remove from G any hypothesis that is more specific than another
hypothesis in G

45
Candidate-EliminationAlgorithm
The version space will converge toward the correct target
concepts if:
H contains the correct target concept
There are no errors in the training examples

Atraining instance to be requested next should discriminate


among the alternative hypotheses in the current version
space:

46
Candidate-EliminationAlgorithm
Partially learned concept can be used to classify new
instances using the majority rule.
S4 = {<Sunny,Warm, ?, Strong, ?, ?>}


<Sunny,?, ?, Strong, ?, ?> <Sunny,Warm, ?, ?, ?, ?> <?, Warm, ?, Strong, ?, ?>


G4 = {<Sunny,?, ?, ?, ?, ?>, <?, Warm, ?, ?, ?, ?>}

5 Rainy Warm High Strong Cool Same ?


47
Inductive Bias

Size of the instance space: |X| = 3.2.2.2.2.2 = 96

Number of possible concepts = 2|X| = 296

Size of H = (4.3.3.3.3.3) + 1 = 973 << 296

48
Inductive Bias

Size of the instance space: |X| = 3.2.2.2.2.2 = 96

Number of possible concepts = 2|X| = 296

Size of H = (4.3.3.3.3.3) + 1 = 973 << 296

a biased hypothesis space

49
Inductive Bias

An unbiased hypothesis space Hthat can represent every


subset of the instance space X: Propositional logic
sentences

Positive examples: x 1, x2, x3


Negative examples: x 4, x5

h(x) (x = x 1) (x = x 2) (x = x 3) x 1 x 2 x3

h(x) (x x 4) (x x 5) x4 x5

50
Inductive Bias
x1 x 2 x 3

x1 x 2 x 3 x 6

x4 x5

Any new instance x is classified positive by half of the version space, and
negative by the other half
not classifiable

51
Inductive Bias
Example Day Actor Price EasyTicket

1 Mon Famous Expensive eYs


2 Sat Famous Moderate No
3 Sun Infamous Cheap No
4 Wed Infamous Moderate eYs
5 Sun Famous Expensive No
6 Thu Infamous Cheap eYs
7 Tue Famous Expensive eYs
8 Sat Famous Cheap No

9 Wed Famous Cheap ?


10 Sat Infamous Expensive ?
52
Inductive Bias

Example Quality Price Buy

1 Good Low eYs

2 Bad High No

3 Good High ?

4 Bad Low ?

53
Inductive Bias

Alearner that makes no prior assumptions regarding the


identity of the target concept cannot classify any unseen
instances.

54
Homework

Exercises 2-1 2.5 (Chapter 2, MLtextbook)

55

You might also like