Module-2 ML Part
Module-2 ML Part
a r
d d
H u
s h
a he
M
s h
Decision Tree Learning: Introduction, Decision tree representation, appropriate problems, ID3 algorithm. Artificial Neural
he
Network: Introduction, NN representation, appropriate problems, Perceptions, Back propagation algorithm.
M a
Texbook2: Chapter 3 (3.1-3.4), Chapter 4 (4.1-4.5) RBT: L1, L2, L3
Module – 4 10 Hours
Bayesian Learning: Introduction, Bayes theorem, Bayes theorem and concept learning, ML and LS error hypothesis, ML for
predicting, MDL principle, Bates optimal classifier, Gibbs algorithm, Naive Bayes classifier, BBN, EM Algorithm
Texbook2: Chapter 6 RBT: L1, L2, L3
Module – 5 12 Hours
Instance-Base Learning: Introduction, k-Nearest Neighbor Learning, Locally weighted regression, Radial basis function, Case-
Based reasoning. Reinforcement Learning: Introduction, The learning task, Q-Learning.
Watch Video Tutorial at https://www.youtube.com/@MaheshHuddar
Textbook 1: Chapter 8 (8.1-8.5), Chapter 13 (13.1 – 13.3) RBT: L1, L2, L3
Syllabus - Lab
1. Implement A* Search algorithm.
2. Implement AO* Search algorithm.
3. For a given set of training data examples stored in a .CSV file, implement and demonstrate the Candidate-
Elimination algorithm to output a description of the set of all hypotheses consistent with the training examples.
4.
a r
Write a program to demonstrate the working of the decision tree based ID3 algorithm. Use an appropriate data
d d
set for building the decision tree and apply this knowledge to classify a new sample.
5. H u
Build an Artificial Neural Network by implementing the Backpropagation algorithm and test the same using
appropriate data sets. s h
6.
a he
Write a program to implement the naïve Bayesian classifier for a sample training data set stored as a .CSV file.
M
Compute the accuracy of the classifier, considering few test data sets.
7. Apply EM algorithm to cluster a set of data stored in a .CSV file. Use the same data set for clustering using k-
Means algorithm. Compare the results of these two algorithms and comment on the quality of clustering. You
can add Java/Python ML library classes/API in the program.
8. Write a program to implement k-Nearest Neighbour algorithm to classify the iris data set. Print both correct and
wrong predictions. Java/Python ML library classes can be used for this problem.
9. Implement the non-parametric Locally Weighted
Watch Video Tutorial at
Regression algorithm in order to fit data points. Select
https://www.youtube.com/@MaheshHuddar
appropriate data set for your experiment and draw graphs
a r
d d
H u
s h
a he
M
ar Director, DARPA)
• “Machine learning is the next Internet” (Tony Tether,
d
u d
H Hennessy, President, Stanford)
• Machine learning is the hot new thing” (John
h
s
e of machine learning” (Prabhakar Raghavan,
•
a h
“Web rankings today are mostly a matter
Dir. Research, Yahoo)
M
• “Machine learning is going to result in a real revolution” (Greg Papadopoulos, CTO,
Sun)
a r
d d
H u
s h
a he
M
a r
d d
H u
s h
a he
M
a r
d d
H u
s h
a he
M
• Unsupervised learning
a r
• Reinforcement learning d d
H u
s h
a he
M
• Once it is trained we can test our model by testing it with some test new mails and
checking of the model is able to predict the right output.
Watch Video Tutorial at https://www.youtube.com/@MaheshHuddar
a r
d d
H u
s h
a he
M
a r
d d
H u
s h
a he
M
a r
d d
H u
s h
a he
M
• It is basically leveraging the rewards obtained, the agent improves its environment
Watch Video Tutorial at https://www.youtube.com/@MaheshHuddar
knowledge to select the next action.
a r
d d
H u
s h
a he
M
– Unusual patterns of sensor readings in a nuclear power plant or unusual sound in your car engine.
• Prediction:
Watch Video Tutorial at https://www.youtube.com/@MaheshHuddar
– Future stock prices or currency exchange rates
Influence of Disciplines on Machine Learning
Artificial intelligence
• Learning symbolic representations of concepts. Machine learning as a search problem. Learning as an approach to
improving problem solving. Using prior knowledge together with training data to guide learning.
a r
Bayesian methods
d d
•
H u
Bayes' theorem as the basis for calculating probabilities of hypotheses. The naive Bayes classifier. Algorithms for
s h
he
estimating values of unobserved variables.
Control theory
• Procedures that learn to control processes in order to optimize predefined objectives and that learn to predict the
next state of the process they are controlling.
Watch Video Tutorial at https://www.youtube.com/@MaheshHuddar
Influence of Disciplines on Machine Learning
Information theory
• Measures of entropy and information content. Minimum description length approaches to learning. Optimal
codes and their relationship to optimal training sequences for encoding a hypothesis.
Philosophy
a r
d d
•
H u
Occam's razor, suggesting that the simplest hypothesis is the best. Analysis of the justification for generalizing
beyond observed data.
s h
Psychology and neurobiology a he
•
M
The power law of practice, which states that over a very broad range of learning problems,
• people's response time improves with practice according to a power law. Neurobiological studies motivating
artificial neural network models of learning.
Statistics
• Characterization of errors (e.g., bias and variance) that occur when estimating the accuracy of a hypothesis based
Watch Video Tutorial at https://www.youtube.com/@MaheshHuddar
on a limited sample of data. Confidence intervals, statistical tests.
CONCEPT LEARNING
• The problem of inducing general functions from specific training
examples is central to learning.
a r
• Concept learning can be formulated as a dproblem of searching through a
u d
h H
predefined space of potential hypotheses for the hypothesis that best fits
es
a h
the training examples. M
• What is Concept Learning…?
a r
d d
H u
s h
a he
M
• The task is to learn to predict the value of EnjoySport for an arbitrary day,
based on the values of its other attributes.
a r
d d
H u
s h
a he
M
a r
d d
H u
s h
a he
M
a r
d d
H u
s h
a he
M
r
of a conjunction of constraints on the instance attributes.
a
d d
• In particular, let each hypothesis be a vectoruof six constraints, specifying the values
h H
es Wind, Water, and Forecast.
h
of the six attributes Sky, AirTemp, Humidity,
M a
• For each attribute, the hypothesis will either
a r
d d
H u
s h
a he
M
1. (Sunny, Warm, Normal, Strong, Warm, Same)
4.Watch(?,
Video Tutorial at
Cold, High, ?, ?, ?) https://www.youtube.com/@MaheshHuddar
A CONCEPT LEARNING TASK
• The most general hypothesis-that every day is a positive example-is
represented by
a r
d
(?, ?, ?, ?, ?, ?)
d
H u
s h
h e
a
M hypothesis-that no day is a positive
• and the most specific possible
example-is represented by
(ø, ø, ø, ø, ø, ø)
a r
d d
H u
s h
a he
M
a r
d d
H u
s h
a he
M
a r
d d
H u
s h
a he
M
• Our EnjoySport example is a very simple learning task, with a relatively small, finite
hypothesis space.
Watch Video Tutorial at https://www.youtube.com/@MaheshHuddar
A CONCEPT LEARNING TASK – Hypothesis Space
a r
d d
H u
s h
a he
M
a r
d d
H u
s h
a he
M
a r
d d
H u
s h
a he
M
a r
d d
H u
s h
a he
M
a r
d d
H u
s h
a he
M
a r
d d
H u
s h
a he
M
a r
d d
H u
s h
a he
M
a r
d d
H u
s h
a he
M
a r
d d
H u
s h
a he
M
a r
d d
H u
s h
h e this instance space?
1. a
How many concepts are possible
M
for
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
Watch Video Tutorial at https://www.youtube.com/@MaheshHuddar
observing an example.
a r
d d
H u
shinstance space?
1. How many concepts are possible for this
e
a h
Solution: 2 * 3 * 2 * 2 * 3 = 72 M
2. How many hypotheses can be expressed by the hypothesis language?
Solution: 4 * 5 * 4 * 4 * 5 = 1600
a r
h0 = (ø, ø, ø, ø, ø)
d d
H u
Step 2:
s h
he
a many) – No
X1 = (some, small, no, expensive,
M
Negative Example Hence Ignore
h1 = (ø, ø, ø, ø, ø)
a r
h2 = (many, big, no, expensive, one)
d d
H u
X3 = (some, big, always, expensive, h
few) – No
es
a
Negative example hence Ignore h
M
h3 = (many, big, no, expensive, one)
a r
h4 = (many, ?, no, expensive, ?)
d d
H u
h – Yes
X5 = (many, small, no, affordable, many)
s
h e
h5 = (many, ?, no, ?, ?)
M a
Step 3:
h5 = (many, ?, no, ?, ?)
Watch Video Tutorial at https://www.youtube.com/@MaheshHuddar
a r
d d
H u
s h
a he
M
chance that the training examples will contain at least some errors or noise. Such inconsistent
language H for the EnjoySport task, there is always a unique, most specific hypothesis
consistent with any set of positive examples. However, for other hypothesis spaces there can
be several
Watch maximally
Video Tutorial at specific hypotheses consistent with the data.
https://www.youtube.com/@MaheshHuddar
a r
d d
H u
s h
a he
M
example in D
Consistent(h, D) ( x, c(x) D) h(x) = c(x))r
d a
u d
h H
Example Citations Size
s
InLibrary Price Editions Buy
1 Some Small a he No Affordable One No
2 Many BigM No Expensive Many Yes
• Semantically Distinct Hypothesis : (A, X), (A, Y), (A, ?), (B, X), (B, Y), (B, ?), (?, X),
(?, Y (?, ?), (ø, ø) – 10
Watch Video Tutorial at https://www.youtube.com/@MaheshHuddar
Consistent Hypothesis and Version Space
• Version Space: (A, X), (A, Y), (A, ?), (B, X), (B, Y), (B, ?), (?, X), (?, Y) (?, ?), (ø, ø),
• Training Instances
a r
d
F1 F2
H ud
Target
Xs h
A
h e Yes
M a
A Y Yes
Problems
• a r
The hypothesis space mustddbe finite
H u
s h
• h
Enumeration of all the e hypothesis, rather inefficient
M a
h e
S4 Sunny, Warm,
M a ?, Strong, ?, ?
G0:Watch G
Video Gat2:
1: Tutorial ?, ?, ?, ?, ?, ?
https://www.youtube.com/@MaheshHuddar
Learned Version Space by Candidate Elimination Algorithm
S Sunny, Warm, ?, Strong, ?, ?
a r
d d
H u
Sunny, ?, ?, Strong, ?, ? s h
Sunny, Warm, ?, ?, ?, ? ?, Warm, ?, Strong, ?, ?
a he
M
a r
d d
H u
s h
a he
M
a r
d d
H u
s h
a he
M
S2: (0, 0, 0)
G2: (Small, Blue, ?) (Small, ?, Circle) (?, Blue, ?) (Big, ?, Triangle) (?, Blue, Triangle)
Watch
G0:Video
(?, Tutorial
?, ?) at https://www.youtube.com/@MaheshHuddar
Candidate Elimination Algorithm
Solved Example
d a r - 3
u d
h H
s
a he
M
G2: (?, ?, ?, ?, ?)
G1: (?, ?, ?, ?, ?)
G0: (?, ?, ?, ?, ?)
Watch Video Tutorial at https://www.youtube.com/@MaheshHuddar
Candidate Elimination Algorithm
r
Solved Example
Hu
d d a - 5
s h
a he
M
S1: (Round, Triangle, Round, Purple, Yes) 1 Round Triangle Round Purple Yes Yes
S2: (Round, Triangle, Round, Purple, Yes) 2 Square Square Square Green Yes No
5
s h Square
Square Round Yellow Yes Yes
G5: (?, ?, Round, ?, Yes)
h e
M a
G4: (Square, Triangle, ?, ?, ?) (?, Triangle, Square, ?, ?) (?, Triangle, ?, Yellow, ?) (?, Triangle, ?, Purple, ?) (?, Triangle, ?, ?, yes)
(Square, ?, Round, ?, ?) (?, Square, Round, ?, ?) (?, ?, Round, Yellow, ?) (?, ?, Round, Purple, ?) (?, ?, Round, ?, Yes)
G3: (?, Triangle, ?, ?, ?) (?, ?, Round, ?, ?)
G2: (Round, ?, ?, ?, ?) (?, Triangle, ?, ?, ?) (?, ?, Round, ?, ?) (?, ?, ?, Purple, ?)
G1: (?, ?, ?, ?, ?)
G0: (?, ?,Watch
?, ?,Video
?) Tutorial at https://www.youtube.com/@MaheshHuddar
Candidate Elimination Algorithm - Solved Example - 5
S0: (0, 0, 0, 0, 0) Ex Eyes Nose Head Fcolor Hair Smile
S1: (Round, Triangle, Round, Purple, Yes) 1 Round Triangle Round Purple Yes Yes
S2: (Round, Triangle, Round, Purple, Yes) 2 Square Square Square Green Yes No
5
s h Square
Square Round Yellow Yes Yes
G5: (?, ?, Round, ?, Yes)
h e
M a
G4: (Square, Triangle, ?, ?, ?) (?, Triangle, Square, ?, ?) (?, Triangle, ?, Yellow, ?) (?, Triangle, ?, Purple, ?) (?, Triangle, ?, ?, yes)
(Square, ?, Round, ?, ?) (?, Square, Round, ?, ?) (?, ?, Round, Yellow, ?) (?, ?, Round, Purple, ?) (?, ?, Round, ?, Yes)
G3: (?, Triangle, ?, ?, ?) (?, ?, Round, ?, ?)
G2: (Round, ?, ?, ?, ?) (?, Triangle, ?, ?, ?) (?, ?, Round, ?, ?) (?, ?, ?, Purple, ?)
G1: (?, ?, ?, ?, ?)
G0: (?, ?,Watch
?, ?,Video
?) Tutorial at https://www.youtube.com/@MaheshHuddar
a r
d d
H u
s h
a he
M
Correct Hypothesis?
a r
d d
H u
s h
2. How Can Partially Learned Concepts Be Used?
h e
M a
3. What Training Example Should the Learner Request Next?
• The learned Version Space correctly describes the target concept, provided:
a r
d
1. There are no errors in the training examples
d
H u
s h
2. There is some hypothesis that correctly describes the target concept
h e
M a
• If S and G converge to a single hypothesis the concept is exactly learned
examples
Watch Video Tutorial at https://www.youtube.com/@MaheshHuddar
Remarks On Version Spaces And Candidate-Elimination Algorithm
How Can Partially Learned Concepts Be Used?
• The learner is required to classify new instances that it has not yet
observed. a r
d d
u
H contains multiple hypotheses,
• Even though the version space ofshFigure
h e
M a
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.
• 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 (shown in Figure).
a r
•
d
Because the hypotheses in the version space unanimouslyd agree that this is a positive
H u
instance, the learner can classify instance A has positive with the same confidence it would
es
h
have if it had already converged to theasingle, correct target concept.
M
• Regardless of which hypothesis in the version space is eventually found to be the correct
target concept, it is already clear that it will classify instance A as a positive example.
• 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.
r hypotheses classify it as positive
• Instance C presents a different situation. Half of the versionaspace
d d
H
and half classify it as negative. Thus, the learner cannotu classify this example with confidence until
s h
further training examples are available.
h e
•
a
Finally, instance D is classified as positiveMby 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.
Watch Video Tutorial at https://www.youtube.com/@MaheshHuddar
Remarks On Version Spaces And Candidate-Elimination Algorithm
How Can Partially Learned Concepts Be Used?
• The learner is required to classify new instances that it has not yet observed.
a r
d d
H u
s h
a he
M
a r
d d
H u
s h
a he
M
• Up to this point we have assumed that training examples are provided to the
a r
learner by some external teacher.
d d
H u
sh to conduct experiments in which it
• Suppose instead that the learner is allowed
e
a h
chooses the next instance, thenM
obtains the correct classification for this instance
• Consider the version space learned from the four training examples of the
a r
Enjoysport concept.
d d
H u
sh to pose at this point?
• What would be a good query for the learner
e
a h
• What is a good query strategy inMgeneral?
• The learner should choose an instance that would be classified positive by some
provided
• Can we avoid this difficulty by using a hypothesis space that includes every possible
hypothesis?
a r
d d
H u
S0: <, , , , . >
s h
S1: <Sunny, Warm,h e Strong, Cool, Change>
a Normal,
S2: <?, Warm,M
Normal, Strong, Cool, Change>
S3: <?, Warm, Normal, Strong, Cool, Change>
G2: <?, ?, ?, ?, ?, ?>
G1: <?, ?, ?, ?, ?, ?>
G0: <?, ?, ?, ?, ?, ?>
Watch Video Tutorial at https://www.youtube.com/@MaheshHuddar
Inductive Bias of Candidate-Elimination Algorithm
A Biased Hypothesis Space
a r
d d
H u
s h
h e space is unable to represent even
• Because of the restriction, the hypothesis
M a
simple disjunctive target concepts such as "Sky = Sunny or Sky = Cloudy.“
• < “Sky = Sunny or Sky = Cloudy”, Warm, Normal, Strong, Cool, Change>
• The obvious solution to the problem of assuring that the target concept is in the
• In the EnjoySport learning task, for example, the size of the instance space X of
a r
d d
H u
s h
a he
Equivalent M
Deductive System
r
function, given sufficient training data? Which algorithms perform best for which
a
d d
types of problems and representations?
H u
s h general bounds can be found to relate
h e
2. How much training data is sufficient? What
a
M to the amount of training experience and the
the confidence in learned hypotheses
character of the learner's hypothesis space?
3. 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
Watch Video Tutorial at
approximately correct? https://www.youtube.com/@MaheshHuddar
Issues in Machine Learning
4. 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?
a r
d d
5. What is the best way to reduce the H u
learning task to one or more function
s h
h e way, what specific functions should the
a
approximation problems? Put another
M
system attempt to learn? Can this process itself be automated?
6. How can the learner automatically alter its representation to improve its
ability to represent and learn the target function?