Ai Unit5 Learning
Ai Unit5 Learning
Data
Output
Computer
Machine Progra
Learning
m Data
Progra
Output Computer
m
Learning agents
Learning Agents
It allows the agent to operate in unknown
environment.
4 components:
1) Learning element.
2) Performance element.
3) Critic.
4) Problem generator.
Learning element:
Responsible for making improvements.
Performance element:
Responsible for selecting external action.
(entire agent)-Percepts and decides on action.
Critic:
Learning element uses feedback from critic-
how the agent is doing, how the performance
element should be modified to do better in
future.
Problem generator:
Responsible for suggesting actions that will
lead to new and informative experiences.
LEARNING ELEMENT
Eg: tip at the end of journey can be a reward to taxi driver and
vice versa
machine learning algorithm
Every machine learning algorithm has three components:
Representation: how to represent knowledge. Examples include
decision trees, sets of rules, instances.
Evaluation: the way to evaluate candidate programs
(hypotheses). Examples include accuracy, prediction and recall,
squared error.
Optimization: the way candidate programs are generated known
as the search process. For example combinatorial optimization,
convex optimization, constrained optimization.
Supervised Learning
Supervised learning is the type of machine learning in
which machines are trained using well "labeled" training
data, and on basis of that data, machines predict the
output
Regression algorithms are used if
there is a relationship between
the input variable and the output
variable. It is used for the
prediction of continuous
variables, such as Weather
forecasting, Market Trends, etc
Classification algorithms are
used when the output variable
is categorical, which means
there are two classes such as Yes-
No, Male-Female, True-false, etc.
x- Polynomial of degree 1 .
Polynomial of degree - n
We say that the learning problem is
Realizable- if the hypothesis contains true
function
Ex: f(x)=ax+b+csin(x)
Otherwise- Unrealizable(we cannot tell the
learning problem is realizable,bcoz always true
function is not known.)
Inductive learning-concept
learning
A new field of machine learning known as inductive
learning has been introduced to help in inducing
general rules and predicting future activities.
In general,
c
Entropy S pi log 2 pi
i 1
Information Gain
• The expected reduction in entropy achieved
by splitting the training examples
Sv
GainS , A Entropy S Entropy S v
vValues A S
Find entropy and information gain
for the attributes A,B and C .derive
the decision tree for the given
classification.
INSTANCE A B C CLASSIFI
S CATION
1 T T F YES
2 T T F YES
3 T F F NO
4 F F F YES
5 F T T NO
6 F T T NO
Find entropy and information gain
for the attributes a1 and a2 .derive
the decision tree.
Choosing the Best Attribute
We need a measure of “good” and “bad” for attributes.
One way to do this is to compute the information content at
a node, i.e. at node R
L
Σ
I(R) = −P (ci) log2 P (ci)
i=1
where {c1,... , cL} are the L class labels present at the node,
and
P (ci) is the probability of getting class ci at the node.
A unit of information is called a “bit”.
Choosing the Best Attribute (cont.)
Example:
At the root node of the restaurant problem, c1 = T rue,
c2 = False and there are 6 T rue samples and 6 False samples.
Therefore no. of samples = c 1 6
P (c1) = = = 0.5
total no. of samples 6+ 6
no. of samples = c 2 6
P (c2) = = = 0.5
total no. of samples 6+ 6
I(Root) = −0.5 × log2 0.5 − 0.5 × log2 0.5 = 1 bit
Training set
Original
training set
Validation set