



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!




Chris Brooks Department of Computer Science University of San Francisco ?? Department of Computer Science — University of San Francisco – p.1/
What does it mean for an agent to learn? ?? Department of Computer Science — University of San Francisco – p.2/
What does it mean for an agent to learn? Agent acquires new knowledge Agent changes its behavior Agent improves its performance measure on a given task ?? Department of Computer Science — University of San Francisco – p.3/
Recall that at the beginning of the semester we talked learning agents about Performance standard Agent Environment Sensors element Performance changes knowledge goalslearning Problemgenerator feedback element Learning Critic Actuators ?? Department of Computer Science — University of San Francisco – p.4/
and a performance element A learning agent has a
. learning element The performance element is what an agent uses to decide what to do. This is what we’ve studied up to now. The learning element is what allows the agent to modify the performance element. This might mean adding or changing rules or facts, modifying a heuristic, changing a successor function In order to modify its behavior, an agent needs information telling it how well it is performing. . feedback This information is called
There are essentially three categories of learning tasks, each of which provides different feedback. Supervised learning. In this case, an external source (often called a teacher) labeled examples provides the agent with Agent sees specific actions/cases, along with their classification.
Unsupervised Learning In this case, there is no teacher to provide examples. The agent typically tries to find a “concept” or pattern in data. Statistical methods such as clustering fall into this category Reinforcement Learning This is a particular version of learning in which the for taking an action. reward agent only receives a May not know how optimal a reward is. Will not know the “best” action to take ?? Department of Computer Science — University of San Francisco – p.7/
Supervised learning is one of the most common forms of learning. Agent is presented with a set of labeled data and must use this data to determine more general rules. Examples: List of patients and characteristics: what factors are correlated with cancer? What factors make someone a credit risk? What are the best questions for classifying animals? Whose face is in this picture? This process of learning general rules from specific facts
. induction is called ?? Department of Computer Science — University of San Francisco – p.8/
We can phrase the learning problem as that of estimating that tells us how to classify a set of inputs. f a function and the corresponding x An example is a set of inputs )x( f << M ammal, EatsM eat, BlackStripes, T awny >, T iger > We can define the learning task as follows: H , find a function f Given a collection of examples of for our examples. f that approximates
. hypothesis is called a H ?? Department of Computer Science — University of San Francisco – p.9/
generalize to H We would like will correctly classify unseen H This means that examples. If the hypothesis can correctly classify all of the training hypothesis. consistent examples, we call it a Goal: find a consistent hypothesis that also performs well on unseen examples. We can think of learning as search through a space of hypotheses. ?? Department of Computer Science — University of San Francisco – p.10/
Notice that induction is not sound. In picking a hypothesis, we make an educated guess.
. bias the way in which we make this guess is called a All learning lagorithms have a bias; identifying it can help you understand the sorts of errors it will make. Examples: Occam’s razor Most specific hypothesis. Most general hypothesis. Linear function ?? Department of Computer Science — University of San Francisco – p.11/
Agents may have different means of observing examples of a hypothesis. learning algorithm is presented with a large set of batch A data all at once and selects a single hypothesis. learning algorithm receives examples one incremental An at a time and continually modifies its hypothesis. Batch is typically more accurate, but incremental may fit better with the agent’s environment. learning agent is able to choose examples. active An learning agent has examples presented to it by passive A an outside source. Active learning is more powerful, but may not fit with ?? Department of Computer Science — University of San Francisco – p.12/ the constraints of the domain.
We can construct a decision tree recursively:
Yes No Yes No Yes No Yes No Full Some None 0-10 10-30 30-60 > Alternate? Yes^ No Hungry? Reservation? Raining? Bar? Alternate? Patrons? Fri/Sat? Yes No Yes No Yes Yes No Yes Yes No Yes No YesYes^ No Yes No WaitEstimate? hand-constructed The tree. Full Some None Patrons? Yes (^) Hungry? No Yes No No Yes Fri/Sat? No Yes No Yes Type? Burger Thai Italian French No Yes Notice The induced tree. that it’s simpler and dis- covers a relationship be- tween Thai food and wait- ing. ?? Department of Computer Science — University of San Francisco – p.20/
The key to constructing a compact and efficient decision tree is to effectively choose attributes to test. Intuition: we want to choose tests that will separate our data set into positive and negative examples. provided information We want to measure the amount of by a test. This is a mathematical concept that characterizes the number of bits needed to answer a question or provide a fact. ?? Department of Computer Science — University of San Francisco – p.21/
Example: let’s say I’m trying to predict the flip of a coin. Before the flip, one bit (heads/tails) is enough to completely answer the question. After I’ve seen the coin, additional bits contain no information, since they don’t provide new knowledge. ?? Department of Computer Science — University of San Francisco – p.22/
possible answers n More formally, let’s say there are to a question, and each answer has probability^ n , ..., v^2 , v^1 v of occuring. )nv( P of the answer to the question is: information content The
n∑ )iv( P^2 log)iv( P−^ =1i
. = 1^122 log^12 − +^122 log^12 − For a coin, this is: Questions with one highly likely anwer will have low information content. (if the coin comes up heads 99/100 of the time, I = 0.08) Information content is also sometimes called entropy. This is often used in compression and data transfer algorithms
For decision trees, we want to know how valuable each possible test is, or how much information it yields. We can estimate the probabilities of possible answers from the training set. Usually, a single test will not be enough to completely separate positive and negative examples. Instead, we need to think about how much better we’ll be after asking a question.
. information gain This is called the
negative n positive examples and p If a training set has examples, the information in a correct answer is: nn+ p (^2) log nn+ p − np+ p (^2) log np+ p − ) = nn+ p , np+ p ( I We want to find the attribute that will come the closest to separating the positive and negative examples. We begin by computing the remainder - this is the .A information still in the data after we test attribute possible values. This test v can take on A Say attribute
.^ v , ..., E^2 , E^1 E new subsets of data, labeled v will create The remainder is the sum of the information in each of these subsets. ) =A( Remainder v ∑ =1i in+i p (I ∗^ n+^ p ip ,^ in+i^ p in )^ in+i^ p ?? Department of Computer Science — University of San Francisco – p.25/
Information gain can then be quantified as the difference between the original information (before the test) and the new information (after the test). )A( Remainder − )^ nn+^ p ,^ np+^ p (I ) =A( Gain Heuristic: Always choose the attribute with the largest information gain. Question: What kind of search is this? ?? Department of Computer Science — University of San Francisco – p.26/
PlayTennis Wind Humidity Temperature Outlook Day No Weak High Hot Sunny D No Strong High Hot Sunny D Yes Weak High Hot Overcast D Yes Weak High Mild Rain D Yes Weak Normal Cool Rain D No Strong Normal Cool Rain D Yes Strong Normal Cool Overcast D No Weak High Mild Sunny D Yes Weak Normal Cool Sunny D Yes Weak Normal Mild Rain D Yes Strong Normal Mild Sunny D Yes Strong High Mild Overcast D Yes Weak Normal Hot Overcast D No Strong High Mild Rain D ?? Department of Computer Science — University of San Francisco – p.27/
Which attribute is the best classifier? Normal High Humidity [6+,1-] [3+,4-] Wind Strong Weak [3+,3-] [6+,2-] = .940 - (8/14).811 - (6/14)1.0= .048^ = .940 - (7/14).985 - (7/14).592=. ) Wind Gain (S, ) Gain (S, Humidity =0.940 E =0.940 E =1.00 E =0.811 E =0.592 E =0.985 E [9+,5-] S: [9+,5-] S: ?? Department of Computer Science — University of San Francisco – p.28/
If there are two examples that have the same attributes but different values, a decision tree will be unable to classify them separately.
. noisy We say that this data is Solution: Use majority rule at the parent node.
A common problem is learning algorithms occurs when there are random or anomalous patterns in the data. For example, in the tennis problem, by chance it might turn out that we always play on Tuesdays. The phenomenon of learning quirks in the data is called
. overfitting In decision trees, overfitting is dealt with through pruning. Once the tree is generated, we evaluate the significance of each node.