0% found this document useful (0 votes)
11 views88 pages

MLunit 1

The document provides an overview of Machine Learning, including its definitions, types, algorithms, and applications. It discusses various concepts such as supervised and unsupervised learning, decision trees, and algorithms like KNN and Apriori. Additionally, it addresses issues in machine learning and the design of learning systems.

Uploaded by

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

MLunit 1

The document provides an overview of Machine Learning, including its definitions, types, algorithms, and applications. It discusses various concepts such as supervised and unsupervised learning, decision trees, and algorithms like KNN and Apriori. Additionally, it addresses issues in machine learning and the design of learning systems.

Uploaded by

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

CO-PO MAPPING

Course Name -
Course
Outcomes /
Program
Outcomes 1 2 3 4 5 6 7 8 9 10 11 12
Machine Learning
CO1: Student
should be able to
understand the
basic concepts H H H
such as decision
trees and neural
networks.
CO2 : Ability to
formulate
machine learning
H H M H M M M L
techniques to
respective
problems
CO3: Apply
machine learning
algorithms to
L H L
solve problems of
moderate
complexity

01/22/2025 Dr S Pratap Singh_Machine Learning Presen 1


tation
What is Machine Learning ?

What is Machine Learning ?


• A computer is said to learn from
experience E, with respect to some
class of task T and performance
measure P, if its performance at tasks
in T, as measured by P, improves
with experience E.

• Machine Learning – Evolution of


Machines

01/22/2025 Dr S Pratap Singh_Machine Learning Presen 2


tation
Why is Machine Learning ?

Machine
Algorithm
Learning
Output-
Data as Input Write Program Feeding the examples of
Data input/output
data

COMPUTER
COMPUTER

Program/model
with which you
Program Produces can solve the
Output problem/task

01/22/2025 Dr S Pratap Singh_Machine Learning Presen 3


tation
How Machine Learning work?

Application of Machine Learning ?

01/22/2025 Dr S Pratap Singh_Machine Learning Presen 4


tation
Types of Machine Learning ?

01/22/2025 Dr S Pratap Singh_Machine Learning Presen 5


tation
Topic: KNN -
Algorithm

• The k-nearest neighbors Height (in Weight T Shirt


(KNN) algorithm is a cms) (in kgs) Size

simple, easy-to-implement 158 58 M


supervised machine 158 59 M
158 63 M
learning algorithm that
160 59 M
can be used to solve both 160 60 M
classification and 163 60 M
regression problems 163 61 M
160 64 L
• K = number of nearest
163 64 L
neighbors 165 61 L
• New customer named 165 62 L
‘XYZ' has height 161cm 165 65 L
168 62 L
and weight 61kg.
168 63 L
168 66 L
170 63 L
170 64 L
170 68 L

01/22/2025 Dr S Pratap Singh_Machine Learning Presen 6


tation
Topic: Association Analysis

• For the given Dataset Generate the association rules


Using Apriori Algorithm by considering the values as
support 50% and Confidence is 75%

Transaction Items Purchased Items frequenc Support


ID y
1 Bread, Cheese, Egg, Bread 4 80%
Juice
Chees 3 60%
2 Bread, Cheese, e
Juice
Egg 1 20%
3 Bread, Milk, yogurt
Juice 4 80%
4 Bread, Juice, Milk,
Milk 3 60%
5 Cheese, Juice,Milk Yogur 1 20%
• Support is No. of times
item occurred to the total t
no. of transactions. Remove items with
=> Support=No. of item <50% support.
occurred/Total no. transaction

01/22/2025 Dr S Pratap Singh_Machine Learning Presen 7


tation
Topic: Association Rule Analysis

• Confidence(AB) =
Support(AUB)/Support(A)
Items Pair frequen Suppo sr Rules Confidence
cy rt no
(Bread, 2 40% 1 (BreadJuice) 75%
cheese)
(Bread, Juice) 3 60% 2 (JuiceBread) 75%
(Bread, Milk) 2 40% 3 (Cheese Juice) 100%
( Cheese, 3 60%
Juice) 4 (Juice  Cheese) 75%
(Cheese,
• Remove items 1 Pair with
20%<50% support. Then only Two pairs will be left, ie is (Bread,
Milk)Juice) and (cheese, Juice
• ForMilk)
(Juice, Rules only
2 two pairs
40% that is (Bread, Juice) and (cheese, Juice)
• Now consider item pair (bread, Juice) the rules can be generated are (BreadJuice) and
(JuiceBread) but which rule is to be considered, For that we need consider the
Confidence and calculate the confidence of the rules

01/22/2025 Dr S Pratap Singh_Machine Learning Presen 8


tation
Application of Machine Learning ?

1. Virtual Personal assistance – Google assistant,


Amazon’s Alexa, Microsoft’s Cortana
2. Traffic Prediction- Google Maps, Bing maps,
MAPS.ME
3. Social Media Personalization- product
recommendation next time
4. Email Spam Filtering-
5. Online Fraud Detection – identity theft, Fake
accounts, Man in the middle attacks.
6. Stock Market trading
7. Assistive Medical technology –Disease
Identification
8. Automatic Translation-Language

01/22/2025 Dr S Pratap Singh_Machine Learning Presen 9


tation
Machine Learning
• Machine learning is an application of artificial
intelligence (AI) that provides systems the
ability to automatically learn and improves
from experience without being explicitly
programmed.

• Machine learning focuses on the development


of computer programs that can access data
and use it learn for themselves.
CSE - MLRITM - AUTONOMOUS
Types of Learning
• Supervised Learning
i) Regression
ii) Classification
• Unsupervised Learning
i) Clustering
ii) Association
• Reinforcement Learning
i) Markov Decision Process
ii) Q-Learning
CSE - MLRITM - AUTONOMOUS
WELL-POSED LEARNING PROBLEMS

A computer program is said to learn from


experience E with respect to some of tasks T and
performance measure P, if its performance at
tasks in T, as measured by P, improves with
experience E.

CSE - MLRITM - AUTONOMOUS


Checkers Learning Problem

• Task T: Playing Checkers


• Performance measure P: Percent of games
won against opponents
• Training experience E : Playing practice games
against itself

CSE - MLRITM - AUTONOMOUS


Handwriting Recognition Learning Problem

• Task T : Recognizing and classifying


handwritten words within images
• Performance measure P : Percent of words
correctly classified
• Training Experience E : A database of
handwritten words with given classifications

CSE - MLRITM - AUTONOMOUS


Robot Driving Learning Problem

• Task T: Driving on public four-lane highways


using vision sensors
• Performance measure P: Average distance
traveled before an error
• Training experience E : A sequence of images
and setting commands recorded

CSE - MLRITM - AUTONOMOUS


Applications of Machine Learning

• Financial Services
• Marketing and Sales
• Healthcare
• Transportation
• Oil and Gas

CSE - MLRITM - AUTONOMOUS


DESIGNING A LEARNING SYSTEM
• Choosing the training experience
 Direct or indirect feedback
 Degree to which learner controls the
sequence of training examples
 How well it represents the distribution of
examples over which the final system
performance P must me measured

CSE - MLRITM - AUTONOMOUS


DESIGNING A LEARNING SYSTEM
• Choosing the Target Function
What type of knowledge will be learned and how this
will be used by the performance program.

ChooseMove : B->M
B – Set of legal board states
M – Best move
Alternative Target Function: V : B -> R
R – Real value

CSE - MLRITM - AUTONOMOUS


DESIGNING A LEARNING SYSTEM
• If b is arbitrary board state in B then V(b) is

Learning algorithms to acquire only some


approximation to the target function so target
function is often called function approximation .
CSE - MLRITM - AUTONOMOUS
DESIGNING A LEARNING SYSTEM
• Choosing a representation for the target function
x1: the number of the black pieces on the board
x2: the number of the red pieces on the board
x3: the number of the black major on the board
x4: the number of the red major on the board
x5: the number of black pieces threatened by red
x6: the number of red pieces threatened by black

w0 to w6 are numerical coefficients (weights)


CSE - MLRITM - AUTONOMOUS
CSE - MLRITM - AUTONOMOUS
DESIGNING A LEARNING SYSTEM
• Choosing a Function Approximation Algorithm
Estimating Training Values

Adjusting the weights

CSE - MLRITM - AUTONOMOUS


• = 0 -> No need to change
weights

• >0 -> Increase weight values

• < 0 -> Decrease weight values

CSE - MLRITM - AUTONOMOUS


DESIGNING A LEARNING SYSTEM

• Final Design

CSE - MLRITM - AUTONOMOUS


CSE - MLRITM - AUTONOMOUS
Issues in Machine Learning
• Which algorithms perform best for which types of problems
and representations?
• How much training data is sufficient?
• When and how can prior knowledge held by the learner
guide the process of generalizing from examples?
• 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?
• How can the learner automatically alter its representation to
improve its ability to represent and learn the target function?
CSE - MLRITM - AUTONOMOUS
Concept Learning

• PERSPECTIVES:
It involves searching a very large space of
possible hypothesis to determine one that best
fits the observed data and prior knowledge held
by the learner.

• Concept Learning: Inferring a boolean-valued


function from training examples of its inputs
and outputs.
01/22/2025 Dr S Pratap Singh 27
Find S Algorithm

01/22/2025 Dr S Pratap Singh 28


Example

01/22/2025 Dr S Pratap Singh 29


01/22/2025 Dr S Pratap Singh 30
01/22/2025 Dr S Pratap Singh 31
01/22/2025 Dr S Pratap Singh 32
01/22/2025 Dr S Pratap Singh 33
LIST-THEN-ELIMINATE ALGORITHM

01/22/2025 Dr S Pratap Singh 34


• Uses the concept of version space
• Considers both +ve and –ve values(yes/no)
• Both specific and general hypothesis
• For positive samples, move from specific to
general
• For negative samples, move from general to
specific

01/22/2025 Dr S Pratap Singh 35


LIST-THEN-ELIMINATE ALGORITHM

01/22/2025 Dr S Pratap Singh 36


LIST-THEN-ELIMINATE ALGORITHM

01/22/2025 Dr S Pratap Singh 37


LIST-THEN-ELIMINATE ALGORITHM

01/22/2025 Dr S Pratap Singh 38


LIST-THEN-ELIMINATE ALGORITHM

01/22/2025 Dr S Pratap Singh 39


CANDIDATE-ELIMINATION
ALGORITHM

CSE-MLRITM-AUTONOMOUS
CSE-MLRITM-AUTONOMOUS
CSE-MLRITM-AUTONOMOUS
CSE-MLRITM-AUTONOMOUS
CSE-MLRITM-AUTONOMOUS
CSE-MLRITM-AUTONOMOUS
CSE-MLRITM-AUTONOMOUS
• INDUCTIVE BIAS:
• Remarks on CE and VS algorithms:
1) Will the CE alg gives us correct hypothesis?
2) What training example should the learner request
next?
Inductive Learning– From examples we derive
rules.
Deductive Learning– Already existing rules are
applied to our examples.
01/22/2025 Dr S Pratap Singh 47
Biased hypothesis space:
Doesnot consider all types of training examples.
Solution-> include all hypothesis.
Unbiased hypothesis space:
Providing a hypothesis capable of representing set
of all examples.
Possible Instances : 3*2*2*2*2*2=96
Target Concepts : 2 power 96(huge)(practically not
possible )
01/22/2025 Dr S Pratap Singh 48
• Idea of Inductive Bias:
• Learner generalizes beyond the observed training examples to
infer new examples.
• ‘>’ inductively inferred from
X>Y (y is inductively inferred from x).
1) Selects in favour of shorter trees over longer trees
2) Selects trees that place the attributes with highest information
gain closest to the root.
-> A preferred bias is more desirable than a restriction bias,
because it allows the learner to work within a complete hypothesis
space that is assures to contain the unknown target function.

01/22/2025 Dr S Pratap Singh 49


DECISION TREE LEARNING
• Decision tree learning is a method for approximating
discrete-valued target functions, in which the learned
function is represented by a decision tree.
• Learned trees can also be re-represented as sets of if-
then rules to improve human readability.
• These learning methods are among the most popular
of inductive inference algorithms such as
ID3,ASSISTANT and C4.5
Decision Tree Representation
(outlook=sunny) ᴧ (Humidity = normal)
V (outlook = overcast)
V (outlook = Rain) ᴧ ( wind = weak)

Gives the final result.


APPROPRIATE PROBLEMS FOR DECISION TREE LEARNING

Best suited to problems with the following


characteristics:
 Instances are represented by attribute-value
pairs. (extensions allows real values)
 The target function has discrete output values
 Disjunctive descriptions may be required
 The training data may contain errors
 The training data may contain missing attribute
values
THE BASIC DECISION TREE LEARNING ALGORITHM

• Follows top-down and greedy search


• ID3 algorithm
• which attribute should be tested at the root of
the tree?
• Which Attribute Is the Best Classifier?
• Information gain : measures how well a given
attribute separates the training examples
according to their target classification.
Decision Tree
• A decision tree is a tree where each node
represents an attribute, each link represents a
decision rule and each leaf represents an
outcome.

CSE-MLRITM-AUTONOMOUS
• Decision Tree to purchase new house

Cost

No<50L
of Bed Rooms >50L
Reject

>=2 <2
Distance from
office Reject
No
<10km >10km
Good
Construction Reject

Yes
Purchase No
Reject
CSE-MLRITM-AUTONOMOUS
Decision tree to Play Tennis

Outlook

Sunny Overcast Rain

Humidity YES
Wind

High Normal Strong Weak

NO YES NO YES

Disjunctive Description:
(outlook=sunny ᴧ Humidity=Normal)V(Outlook=overcast)V(Outlook=rain ᴧ Wind=weak)

CSE-MLRITM-AUTONOMOUS
• A decision tree learning is a method for
approximating discrete valued target
functions, in which the learned function is
represented by a decision tree.
• Learned trees can also be re-represented as
sets of if-then rules.

CSE-MLRITM-AUTONOMOUS
Problems Characteristics
• Instances are represented by attribute-value
pairs.
• The target function has discrete output values.
• Disjunctive descriptions may be required.
• The training data may contain errors.
• The training data may contain missing
attribute values.

CSE-MLRITM-AUTONOMOUS
Decision Tree Algorithms
• ID3
• C4.5
• C5.0
• CART

CSE-MLRITM-AUTONOMOUS
ID3 Algorithm
• Which attribute should be tested at the root
of the tree?
• Selection of descendant of root node.
• To select root node and descendant of root
node we need to concentrate on entropy and
information gain.

CSE-MLRITM-AUTONOMOUS
• Entropy is the measures of impurity ,disorder or
uncertainty in a bunch of examples.
• Information gain is the difference in entropy
before and after splitting dataset on the attribute.
• Information gain is the main key that is used
by Decision Tree Algorithms to construct a
Decision Tree.
• Decision Trees algorithm will always tries to
maximize Information gain.
• An attribute with highest Information gain will
tested/split first.
CSE-MLRITM-AUTONOMOUS
CSE-MLRITM-AUTONOMOUS
Entropy

is the proportion of positive examples in S


is the proportion of negative examples in S

Entropy is zero if all members belongs to same class.


Entropy is one if collection contains equal number
of positive and negative examples.
CSE-MLRITM-AUTONOMOUS
CSE-MLRITM-AUTONOMOUS
CSE-MLRITM-AUTONOMOUS
• Calculation of gain of attribute OUTLOOK

Gain(S,Outlook) =Entropy(s)-I(Outlook)
= 0.940- 0.693 = 0.247

CSE-MLRITM-AUTONOMOUS
• E(Temperature=Hot)= -(2/4) log(2/4)-(2/4)log(2/4) = 1

• E(Temperature=Mild)=-(4/6)log(4/6)-(2/6)log(2/6)= 0.918

• E(Temperature=Cool) = -(3/4)log(3/4)-(1/4)log(1/4)= 0.811

CSE-MLRITM-AUTONOMOUS
• Average information entropy of Temperature

• I(Temperature) =(4/14)*1+(6/14)*0.918+(4/14)*0.811 = 0.911

• Calculation of gain of attribute OUTLOOK

Gain(S,Temperature) =Entropy(s)-I(Temperature)
= 0.940- 0.911 = 0.029

CSE-MLRITM-AUTONOMOUS
Gain(S , Outlook)=0.246
Gain(S , Humidity)= 0.151
Gain(S , Wind)= 0.048
Gain(S , Temperature)= 0.029
 Outlook is selected as the decision attribute for
the root node because of its higher gain value,
and branches are created below the root for
each of its possible values (i.e., Sunny, Overcast,
and Rain).
CSE-MLRITM-AUTONOMOUS
CSE-MLRITM-AUTONOMOUS
• Overcast have zero entropy so it becomes as
leaf node with the classification play tennis as
yes.
• Sunny and Rain still have non-zero entropy
and the decision tree will be elaborated below
these nodes.
• Repeats the above process to select the
descendent nodes.

CSE-MLRITM-AUTONOMOUS
• Repeat the same for descendant of root node

CSE-MLRITM-AUTONOMOUS

CSE-MLRITM-AUTONOMOUS
CSE-MLRITM-AUTONOMOUS
CSE-MLRITM-AUTONOMOUS
CSE-MLRITM-AUTONOMOUS
Attribute Gain
Temperature 0.571
Humidity 0.971
Windy 0.02

• Humidity has greater gain value, so it is


selected as descendant node of root node.

CSE-MLRITM-AUTONOMOUS
CSE-MLRITM-AUTONOMOUS
CSE-MLRITM-AUTONOMOUS
CSE-MLRITM-AUTONOMOUS
CSE-MLRITM-AUTONOMOUS
Gain(srain,Humidity)=O.02
Gain(srain,wind)=0.971
Gain(srain,Temp)=0.02
Wind is selected as next node under rainy.
Outlook Wind Playtennis
Rain Weak Yes
Rain Weak Yes
Rain Strong No
Rain Weak Yes
Rain Strong No

CSE-MLRITM-AUTONOMOUS
Final Decision Tree

CSE-MLRITM-AUTONOMOUS
CSE-MLRITM-AUTONOMOUS
Hypothesis space and inductive bias

01/22/2025 Dr S Pratap Singh 87


Issues in Decision tree Learning

• Determining how deeply a decision tree grow.


• Incorporating continues attributes
• Appropriate attribute selection measure
• Handling training data with missing values
• Handling attributes with differing costs
• Improving the computational efficient
• Overfitting and underfitting problems

01/22/2025 Dr S Pratap Singh 88

You might also like