lOMoARcPSD|35660038
AI - Ch18 Learning From Examples
Artificial Intelligence (Assiut University)
Scan to open on Studocu
Studocu is not sponsored or endorsed by any college or university
Downloaded by Surya Basnet (
[email protected])
lOMoARcPSD|35660038
Artificial Intelligence
Ch 18 : Learning From Examples I
1
Artificial Intelligence -Learning From Examples
lOMoARcPSD|35660038
Last Time: Constraint
Satisfaction Problems
- CSP examples
- Backtracking search for CSPs
- Problem structure and problem
decomposition
- Local search for CSPs
2
Artificial Intelligence -Learning From Examples
lOMoARcPSD|35660038
Outline
- Learning agents
- Inductive learning
- Decision tree learning
- Measuring learning performance
3
Artificial Intelligence -Learning From Examples
lOMoARcPSD|35660038
Learning
- Learning is essential for unknown
environments,
i.e., when designer lacks omniscience
- Learning is useful as a system
construction method,
i.e., expose the agent to reality rather than
trying to write it down
- Learning modifies the agent's
decision mechanisms to improve
performance
4
Artificial Intelligence -Learning From Examples
lOMoARcPSD|35660038
Learning factors
- Which component is to be improved.
- What prior knowledge the agent
already has.
- What representation is used for the
data and the component.
- What feedback is available to learn
from.
5
Artificial Intelligence -Learning From Examples
lOMoARcPSD|35660038
Components to be
learned
1.A direct mapping from conditions on the
current state to actions.
2.A means to infer relevant properties of
the world from the percept sequence.
3.Information about the way the world
evolves and about the results of
possible actions the agent can take.
4.Utility information indicating the
desirability of world states.
5.Action-value information indicating the
desirability of actions.
6.Goals that describe classes of states
whose achievement maximizes the
agent’s utility.
6
Artificial Intelligence -Learning From Examples
lOMoARcPSD|35660038
Case Study
- An agent training to become a taxi driver.
Every time the instructor shouts
“Brake!” the agent might learn a
condition–action rule for when to brake;
the agent also learns every time the
instructor does not shout.
Component 1
- By seeing many camera images that it is
told contain buses, it can learn to
recognize them.
Component 2
- Braking hard on a wet road—it can learn
the effects of its actions.
Component 3
- When a driver receives no tip from
passengers who have been thoroughly
shaken up during the trip, it can learn a
useful component of its overall utility
function.
Component 4
7
Artificial Intelligence -Learning From Examples
lOMoARcPSD|35660038
Representation and prior
knowledge
- Effective learning algorithms have
been devised for different
representations.
Graph, logical sentences, networks, etc.
- We say that learning a general
function or rule from specific input–
output pairs is called inductive
learning.
- We will see later that we can also do
analytical or deductive learning:
going from a known general rule to
a new rule that is logically entailed.
8
Artificial Intelligence -Learning From Examples
lOMoARcPSD|35660038
Feedback to learn from
- In unsupervised learning the agent
learns patterns in the input even
though no explicit feedback is
supplied.
- The most common unsupervised
learning task is clustering:
detecting potentially useful clusters
of input examples.
- For example, a taxi agent might
gradually develop a concept of
“good traffic days” and “bad traffic
days” without ever being given
labelled examples of each by a
teacher.
- In reinforcement learning the agent
learns from a series of
reinforcements—rewards or
punishments.
- For example, the lack of a tip at the
end of the journey gives the taxi
agent an indication that it did
something wrong.
9
Artificial Intelligence -Learning From Examples
lOMoARcPSD|35660038
- It is up to the agent to decide which
of the actions prior to the
reinforcement were most
responsible for it.
- In supervised learning the agent
observes some example input–
output pairs and learns a function
that maps from input to output.
- For examples
An agent training to become a taxi driver: the
inputs are percept and the output are
provided by a teacher who says “Brake!” or
“Turn left.”
An agent that recognizes buses by seeing many
camera images, the inputs are camera
images and the outputs again come from a
teacher who says “that’s a bus.”
- In this case the output value is
available directly from the agent’s
percept (after the fact); the
environment is the teacher.
- In semi-supervised learning we are
given a few labelled examples and
must make what we can of a large
collection of unlabelled examples.
- Imagine that you are trying to build a
system to guess a person’s age from a
photo.
10
Artificial Intelligence -Learning From Examples
lOMoARcPSD|35660038
- You gather some labelled examples by
snapping pictures of people and asking
their age. That’s supervised learning.
- But in reality some of the people lied
about their age. It’s not just that there is
random noise in the data; rather the
inaccuracies are systematic, and to
uncover them is an unsupervised
learning problem involving images, self-
reported ages, and true (unknown)
ages.
- Thus, both noise and lack of labels
create a continuum between
supervised and unsupervised learning.
11
Artificial Intelligence -Learning From Examples
lOMoARcPSD|35660038
SUPERVISED
LEARNING
THEORY
Supervised Learning
- The task of supervised learning is this:
- Here x and y can be any value; they
need not be numbers.
- The function h is a hypothesis.
- Learning is a search through the space
of possible hypotheses for one that will
perform well, even on new examples
beyond the training set.
- To measure the accuracy of a hypothesis
we TEST SET give it a test set of
examples that are distinct from the
training set.
12
Artificial Intelligence -Learning From Examples
lOMoARcPSD|35660038
13
Artificial Intelligence -Learning From Examples
lOMoARcPSD|35660038
Linear and nonlinear
hypothesis
- Construct/adjust h to agree with f on
training set
(h is consistent if it agrees with f on all
examples)
- Curve fitting:
14
Artificial Intelligence -Learning From Examples
lOMoARcPSD|35660038
Classification and
regression
- When the output y is one of a finite
set of values (such as sunny, cloudy
or rainy), the learning problem is
called classification.
It is called Boolean or binary classification if
there are only two values.
- When y is a number (such as
tomorrow’s temperature), the
learning problem is called
regression.
15
Artificial Intelligence -Learning From Examples
lOMoARcPSD|35660038
Probabilistic models for
supervised learning
- Supervised learning can be done by
choosing the hypothesis h^∗ that is
most probable given the data:
- By Bayes’ rule this is equivalent to
- Then we can say that the prior
probability P(h) is high for a degree-
1 or -2 polynomial, lower for a
degree-7 polynomial.
16
Artificial Intelligence -Learning From Examples
lOMoARcPSD|35660038
LEARNING
DECISION TREES
Decision tree
- A decision tree represents a function
that takes as input a vector of
attribute values and returns a
“decision”—a single output value.
- The input and output values can be
discrete or continuous.
17
Artificial Intelligence -Learning From Examples
lOMoARcPSD|35660038
Decision trees: An
example
- Build a decision tree to decide whether
to wait for a table at a restaurant or not.
1.Alternate: whether there is a suitable
alternative restaurant nearby.
2.Bar: whether the restaurant has a
comfortable bar area to wait in.
3.Fri/Sat: true on Fridays and
Saturdays.
4.Hungry: whether we are hungry.
5.Patrons: how many people are in the
restaurant (values are None, Some,
and Full).
6.Price: the restaurant’s price range ($,
$$, $$$).
7.Raining: whether it is raining outside.
8.Reservation: whether we made a
reservation.
9.Type: the kind of restaurant (French,
Italian, Thai, or burger).
10.WaitEstimate: the wait estimated by
the host (0–10 minutes, 10–30, 30–
60, or >60).
18
Artificial Intelligence -Learning From Examples
lOMoARcPSD|35660038
19
Artificial Intelligence -Learning From Examples
lOMoARcPSD|35660038
Decision trees: An
example
20
Artificial Intelligence -Learning From Examples