Machine Learning Concepts and Design
Machine Learning Concepts and Design
INTRODUCTION
Syllabus:
Introduction: Well posed learning problems, Designing a Learning system, Perspective and
Issues in Machine Learning.
Concept Learning and the General-to-Specific Ordering: A Concept Learning Task, Concept
Learning as Search, Find-S: Finding a Maximally Specific Hypothesis, Version Spaces and the
Candidate-Elimination Algorithm, Remarks on Version Spaces and Candidate-Elimination,
Inductive Bias.
Ever since computers were invented, we have wondered whether they might be made to
[Link] we could understand how to program them to learn-to improve automatically with
experience-the impact would be dramatic.
• Imagine computers learning from medical records which treatments are most
effectivefor new diseases
• Houses learning from experience to optimize energy costs based on the particular
usagepatterns of their occupants.
• Personal software assistants learning the evolving interests of their users in
order tohighlight especially relevant stories from the online morning newspaper
A successful understanding of how to make computers learn would open up many new
usesof computers and new levels of competence and customization
• Some tasks cannot be defined well, except by examples (e.g., recognizing people).
• Relationships and correlations can be hidden within large amounts of data.
MachineLearning/Data Mining may be able to find these relationships.
• Human designers often produce machines that do not work as well as desired in
theenvironments in which they are used.
• The amount of knowledge available about certain tasks might be too large for
explicitencoding by humans (e.g., medical diagnostic).
• Environments change over time.
• New knowledge about tasks is constantly being discovered by humans. It may
bedifficult to continuously re-design systems “by hand”.
1
Machine Learning-II Module-1 BAI702
Examples
1. Checkers game: A computer program that learns to play checkers might improve its
performance as measured by its ability to win at the class of tasks involving playing
checkers games, through experience obtained by playing games against itself.
2
Machine Learning-II Module-1 BAI702
The basic design issues and approaches to machine learning are illustrated by designing a
program to learn to play checkers, with the goal of entering it in the world checkers tournament
1. Choosing the Training Experience
2. Choosing the Target Function
3. Choosing a Representation for the Target Function
4. Choosing a Function Approximation Algorithm
a) Estimating training values
b) Adjusting the weights
5. The Final Design
3
Machine Learning-II Module-1 BAI702
b) The degree to which the learner controls the sequence of training examples.
➢ The learner might depends on the teacher to select informative board states and to
provide the correct move for each.
➢ The learner might itself propose board states that it finds particularly confusing and
ask the teacher for the correct move.
4
Machine Learning-II Module-1 BAI702
➢ The learner may have complete control over both the board states and (indirect)
training classifications, as it does when it learns by playing against itself with no
teacher present.
c) How well it represents the distribution of examples over which the final system
performance P must be measured.
➢ 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.
➢ In checkers learning scenario, the performance metric P is the percent of games the
system wins in the world tournament.
➢ If its training experience E consists only of games played against itself, there is a
danger that this training experience might not be fully representative of the
distribution of situations over which it will later be tested.
➢ It is necessary to learn from a distribution of examples that is different from those
on which the final system will be evaluated.
5
Machine Learning-II Module-1 BAI702
6
Machine Learning-II Module-1 BAI702
Where,
• w0 through w6 are numerical coefficients, or weights, to be chosen by the
learningalgorithm.
• 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
• The weight w0 will provide an additive constant to the board value.
➢ 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.
7
Machine Learning-II Module-1 BAI702
➢ Several algorithms are known for finding weights of a linear function that minimize
E. One such algorithm is called the least mean squares, or LMS training rule.
➢ For each observed training example it adjusts the weights a small amount in the
direction that reduces the error on this training example.
➢ The LMS algorithm is defined as follows:
8
Machine Learning-II Module-1 BAI702
1. The Performance System is the module that must solve the given performance task
by using the learned target function(s). It takes an instance of a new problem (new
game) as input and produces a trace of its solution (game history) as output.
2. The Critic takes as input the history or trace of the game and produces as output a set
of training examples of the target function
3. The Generalizer takes as input the training examples and produces an output
hypothesis that is its estimate of the target function. It generalizes from the specific
training examples, hypothesizing a general function that covers these examples and
other cases beyond the training examples.
4. The Experiment Generator takes as input the current hypothesis and outputs a new
problem (i.e., initial board state) for the Performance System to explore. Its role is to
pick new practice problems that will maximize the learning rate of the overall system.
9
Machine Learning-II Module-1 BAI702
The sequence of design choices made for the checkers program is summarized in below figure:
10
Machine Learning-II Module-1 BAI702
• 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?
• 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?
11
Machine Learning-II Module-1 BAI702
CONCEPT LEARNING
➢ A Concept is a subset of objects or events defined over a larger set.
➢ For example, we refer to the set of everything ( i.e. all objects) as the set of things.
➢ Animals are a subset of things, and birds are subset of animals.
➢ In more technical terms, a Concept is a Boolean valued function defined over this
larger set.
➢ For example, a function defined over all animals whose value is true for birds and false for
every other animal.
Formal Definition for Concept learning - Inferring a Boolean-valued function from training
examples of its input and output
Table: Positive and negative training examples for the target concept EnjoySport.
The task is to learn to predict the value of EnjoySport for an arbitrary day, based on the
values of its other attributes?
12
Machine Learning-II Module-1 BAI702
13
Machine Learning-II Module-1 BAI702
➢ The ordered pair (x, c(x)) to describe the training example consisting of the instance x and
its target concept value c(x).
➢ D to denote the set of available training examples.
➢ The symbol H to denote the set of all possible hypotheses that the learner may consider
regarding the identity of the target concept. Each hypothesis h in H represents a Boolean-
valued function defined over X
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.
14
Machine Learning-II Module-1 BAI702
Example:
Consider the instances X and hypotheses H in the EnjoySport learning task. The attribute Sky
has three possible values, and AirTemp, Humidity, Wind, Water, Forecast each have two
possible values, the instance space X contains exactly
[Link].2.2 = 96 distinct instances
[Link].4.4 = 5120 syntactically distinct hypotheses within H.
Every hypothesis containing one or more "Φ" symbols represents the empty set of instances;
that is, it classifies every instance as negative.
1 + ([Link].3.3) = 973. Semantically distinct hypotheses
15
Machine Learning-II Module-1 BAI702
• In the figure, the box on the left represents the set X of all instances, the box on the
right the set H of all hypotheses.
• Each hypothesis corresponds to some subset of X-the subset of instances that it
classifies positive.
• The arrows connecting hypotheses represent the more - general -than relation, with
the arrow pointing toward the less general hypothesis.
• Note the subset of instances characterized by h2 subsumes the subset characterized by
hl , hence h2 is more - general– than h1
➢ FIND-S Algorithm is used to find the Maximally Specific Hypothesis. Using the Find-S
algorithm gives a single maximally specific hypothesis for the given set of training
examples.
➢ FIND-S is guaranteed to output the most specific hypothesis within H that is consistent with
the positive training examples.
➢ One way is to begin with the most specific possible hypothesis in H, then generalize this
hypothesis each time it fails to cover an observed positive training example.
16
Machine Learning-II Module-1 BAI702
Important Representation:
➢ ? Indicates that any value is acceptable for the attribute.
➢ Specify a single required value ( e.g., Cold ) for the attribute.
➢ Φ indicates that no value is acceptable.
➢ The most general hypothesis is represented by: <?, ?, ?, ?, ?, ?>
➢ The most specific hypothesis is represented by : <ϕ, ϕ, ϕ, ϕ, ϕ, ϕ>
FIND-S Algorithm
17
Machine Learning-II Module-1 BAI702
To illustrate this algorithm, assume the learner is given the sequence of training
examplesfrom the EnjoySport task
➢ Consider the next training example (also positive in this case) forces the algorithm to
further generalize h, by substituting a "?' in place of any attribute value in h that is not
satisfied by the new example.
h2 → (Sunny, Warm, ?, Strong, Warm, Same)
➢ Next is negative example, so need to consider.
h3 → (Sunny, Warm, ?, Strong, Warm, Same)
➢ Next, the fourth example leads to further generalization of h
h4 → (Sunny, Warm, ?, Strong, ?, ?)
18
Machine Learning-II Module-1 BAI702
Unanswered by FIND-S
19
Machine Learning-II Module-1 BAI702
Version Space
• Definition: The version space VSH,D is the subset of the hypothesis from H
consistent with the training example in D,
20
Machine Learning-II Module-1 BAI702
➢ Version Space:
– (A, P), (A, Q), (A, ?), (B, P), (B, Q), (B, ?), (?, P), (?, Q), (?, ?), (ø, ø)
➢ Training instances:
Attrib1 Attrib1 Target
A P YES
A Q YES
21
Machine Learning-II Module-1 BAI702
22
Machine Learning-II Module-1 BAI702
An Illustrative Example
23
Machine Learning-II Module-1 BAI702
• When the second training example is observed, it has a similar effect of generalizing S
further to S2, leaving G again unchanged i.e., G2 = G1 = G0
• Consider the third training example. This negative example reveals that the G boundary
of the version space is overly general, that is, the hypothesis in G incorrectly predicts
that this new example is a positive example.
• The hypothesis in the G boundary must therefore be specialized until it correctly
classifies this new negative example
24
Machine Learning-II Module-1 BAI702
➢ Given that there are six attributes that could be specified to specialize G2, why are there
only three new hypotheses in G3?
➢ For example, the hypothesis h = (?, ?, Normal, ?, ?, ?) is a minimal specialization of G2 that
correctly labels the new example as a negative example, but it is not included in G3. The
reason this hypothesis is excluded is that it is inconsistent with the previously
encountered positive examples
➢ Consider the fourth training example.
➢ This positive example further generalizes the S boundary of the version space. It also
results in removing one member of the G boundary, because this member fails to cover the
new positive example.
➢ After processing these four examples, the boundary sets S4 and G4 delimit the version
space of all hypotheses consistent with the set of incrementally observed training examples.
25
Machine Learning-II Module-1 BAI702
➢ Even though the version space above still contains multiple hypotheses, indicating that the
target concept has not yet been fully learned, it is possible to classify certain examples with
the same degree of confidence as if the target concept had been uniquely identified.
➢ To illustrate, suppose the learner is asked to classify the four new instances shown in Table
below:
➢ Note that although instance A was not among the training examples, it is classified as a
positive instance by every hypothesis in the current version space.
➢ Similarly, instance B is classified as a negative instance by every hypothesis in the version
space. This instance can therefore be safely classified as negative, given the partially learned
concept.
26
Machine Learning-II Module-1 BAI702
➢ Instance C presents a different situation. Half of the version space hypotheses classify it as
positive and half classify it as negative. Thus, the learner cannot classify this example with
confidence until further training examples are available.
➢ Finally, instance D is classified as positive by two of the version space hypotheses and
negative by the other four hypotheses. In this case we have less confidence in the
classification than in the unambiguous cases of instances A and B. Still, the vote is in favor of
a negative classification, and one approach we could take would be to output the majority
vote, perhaps with a confidence rating indicating how close the vote was.
INDUCTIVE BIAS
27
Machine Learning-II Module-1 BAI702
➢ Because of this restriction, the hypothesis space is unable to represent even simple
disjunctive target concepts such as “Sky = Sunny or Sky = Cloudy”.
➢ This hypothesis, although it is the maximally specific hypothesis from H that is consistent
with the first two examples, is already overly general.
➢ It incorrectly covers the third (negative) training example.
➢ The problem is that we have biased the learner to consider only conjunctive hypotheses. In
this case we require a more expressive hypothesis space.
An Unbiased Learner
➢ The solution to the problem of assuring that the target concept is in the hypothesis space H
is to provide a hypothesis space capable of representing every teachable concept that is
representing every possible subset of the instances X.
➢ The set of all subsets of a set X is called the power set of X.
➢ In the EnjoySport learning task the size of the instance space X of days described bythe six
attributes is 96 instances.
➢ Thus, there are 296 distinct target concepts that could be defined over this instance spaceand
learner might be called upon to learn.
➢ The conjunctive hypothesis space is able to represent only 973 of these - a biased
hypothesis space indeed.
➢ Let us reformulate the EnjoySport learning task in an unbiased way by defining a new
hypothesis space H' that can represent every subset of instances.
➢ The target concept "Sky = Sunny or Sky = Cloudy" could then be described as
(Sunny, ?, ?, ?, ?, ?) ꓦ (Cloudy, ?, ?, ?, ?, ?)
28
Machine Learning-II Module-1 BAI702
➢ Consider a concept learning algorithm L for the set of instances X. Let c be an arbitrary
concept defined over X, and let Dc = {<x,c(x)>} be an arbitrary set of training examples of c.
➢ After training, L is asked to classify a new instance xi.
➢ Let L(xi, Dc) denote the classification (e.g., positive or negative) that L assigns to xi after
learning from the training data Dc.
➢ We can describe this inductive inference step performed by L as :
29
Machine Learning-II Module-1 BAI702
Inductive Bias-Advantage
➢ It provides a nonprocedural means of characterizing their policy for generalizing beyond
the observed data.
➢ It allows comparison of different learners according to the strength of the inductive bias
they employ.
30
Machine Learning-II Module-1 BAI702
31
Machine Learning-II Module-1 BAI702
Questions on Unit-1
Chapter-1:
Chapter-2:
32
Machine Learning-II Module-1 BAI702
33
Machine Learning-II Module-1 BAI702
Problems on FIND-S
Example-1
34
Machine Learning-II Module-1 BAI702
3. Apply the FIND-S algorithm by hand on the given training set. Consider the examples in the specified
order and write down your hypothesis each time after observing an example.
Example -2
Solution:
35
Machine Learning-II Module-1 BAI702
Example-3
Solutions:
36
Machine Learning-II Module-1 BAI702
Solution:
37
Machine Learning-II Module-1 BAI702
2. Consider the “Japanese Economy Car” Concept and instances given below, identify the
hypothesis using candidate-Elimination learning algorithm.
Solution:
38
Machine Learning-II Module-1 BAI702
3. Consider the Concept and instances given below, identify the hypothesis using
candidate-Elimination learning algorithm.
Solution:
39
.
.
.
.
.
.
.
Observing an example
.
.
.
.
.
.
.
. What is the difference between Find-S algorithm and Candidate Elimination
Examples Used Only positive examples. Both positive and negative examples.
The Find-S and Candidate Elimination algorithms are both used in concept learning, but they
differ in their approach to finding a hypothesis.
Find-S Algorithm
The Find-S algorithm is a straightforward approach that focuses on finding the most specific
hypothesis that is consistent with all the positive training examples. It operates as follows:
• It starts with the most specific possible hypothesis, which is a hypothesis that matches
no examples (e.g., all attributes are set to 'phi').
• For each positive example, it generalizes the current hypothesis only as much as
necessary to accommodate that example.
• The final hypothesis is a single, maximally specific hypothesis that covers all positive
training instances.
The Candidate Elimination algorithm is a more comprehensive approach that identifies a set of
all hypotheses consistent with the training data, known as the version space. This algorithm is
more powerful than Find-S because it uses both positive and negative examples to narrow down
the possible hypotheses.
• It maintains two sets of hypotheses:
o G (General boundary): A set of the most general hypotheses consistent with the
data.
o S (Specific boundary): A set of the most specific hypotheses consistent with the
data.
• It uses positive examples to generalize the specific boundary (S) and negative examples
to specialize the general boundary (G).
• The algorithm continues to refine these boundaries until the version space shrinks to a
single hypothesis or a small set of hypotheses.
If d is positive example
Remove from G any hypothesis h inconsistent with d
For each hypothesis s in S not consistent with d:
Remove s from S
Add to S all minimal generalizations of s consistent with d and having a generalization in
G
Remove from S any hypothesis with a more specific h in S
If d is negative example
Remove from S any hypothesis h inconsistent with d
For each hypothesis g in G not consistent with d:
Remove g from G
Add to G all minimal specializations of g consistent with d and having a specialization in
S
Remove from G any hypothesis having a more general hypothesis in G
.
.
.
.
.
Solution:
The first example is negative, the hypothesis at the specific boundary is consistent, hence we
retain it, and the hypothesis at the generic boundary is inconsistent hence we write all
consistent hypotheses by removing one “?” at a time.
S1: (0, 0, 0)
The second example is negative, the hypothesis at the specific boundary is consistent, hence we
retain it, and the hypothesis at the generic boundary is inconsistent hence we write all
consistent hypotheses by removing one “?” at a time.
S2: (0, 0, 0)
G2: (Small, Blue, ?), (Small, ?, Circle), (?, Blue, ?), (Big, ?, Triangle), (?, Blue, Triangle)
The third example is positive, the hypothesis at the specific boundary is inconsistent, hence we
extend the specific boundary, and the consistent hypothesis at the generic boundary is retained
and inconsistent hypotheses are removed from the generic boundary.
The fourth example is negative, the hypothesis at the specific boundary is consistent, hence we
retain it, and the hypothesis at the generic boundary is inconsistent hence we write all
consistent hypotheses by removing one “?” at a time.
The fifth example is positive, the hypothesis at the specific boundary is inconsistent, hence we
extend the specific boundary, and the consistent hypothesis at the generic boundary is retained
and inconsistent hypotheses are removed from the generic boundary.
Learned Version Space by Candidate Elimination Algorithm for given data set is:
S: G: (Small, ?, Circle)
the Candidate Elimination Algorithm to find the set of consistent hypotheses in Machine
Learning.
.
.
.
Solution:
The first example is negative, the hypothesis at the specific boundary is consistent, hence we
retain it, and the hypothesis at the generic boundary is inconsistent hence we write all
consistent hypotheses by removing one “?” at a time.
S1: (0, 0, 0, 0, 0)
The second example is positive, the hypothesis at the specific boundary is inconsistent, hence
we extend the specific boundary, and the consistent hypothesis at the generic boundary is
retained and inconsistent hypotheses are removed from the generic boundary.
The third example is positive, the hypothesis at the specific boundary is inconsistent, hence we
extend the specific boundary, and the consistent hypothesis at the generic boundary is retained
and inconsistent hypotheses are removed from the generic boundary.
The fourth example is positive, the hypothesis at the specific boundary is inconsistent, hence we
extend the specific boundary, and the consistent hypothesis at the generic boundary is retained
and inconsistent hypotheses are removed from the generic boundary.
G4: (Many,?,?,?,?)
Learned Version Space by Candidate Elimination Algorithm for given data set is:
The Candidate Elimination Algorithm to find the set of consistent hypotheses in Machine
Learning.
.
.
.
.