Upload
oleg-garcia
View
24
Download
0
Embed Size (px)
DESCRIPTION
Lecture 34 of 41. Introduction to Machine Learning. Wednesday, 10 November 2004 William H. Hsu Department of Computing and Information Sciences, KSU http://www.kddresearch.org http://www.cis.ksu.edu/~bhsu Reading: Sections 18.1-18.2 and 18.5, Russell and Norvig. Lecture Outline. - PowerPoint PPT Presentation
Citation preview
Kansas State University
Department of Computing and Information SciencesCIS 730: Introduction to Artificial Intelligence
Lecture 34 of 41Lecture 34 of 41
Wednesday, 10 November 2004
William H. Hsu
Department of Computing and Information Sciences, KSUhttp://www.kddresearch.org
http://www.cis.ksu.edu/~bhsu
Reading:
Sections 18.1-18.2 and 18.5, Russell and Norvig
Introduction to Machine Learning
Kansas State University
Department of Computing and Information SciencesCIS 730: Introduction to Artificial Intelligence
Lecture OutlineLecture Outline
• Today’s Reading– Sections 18.1-18.2, 18.5, Russell and Norvig
– References: Chapters 1-3, Machine Learning, Mitchell
• Next Week: Sections 18.3-18.4, 18.6-18.7, Russell and Norvig
• Previously: Representation and Reasoning (Inference)– Logical
– Probabilistic (“Soft Computing”)
• Today: Introduction to Learning– Machine learning framework
– Definitions
• Taxonomies: supervised, unsupervised, reinforcement
• Instance spaces (X)
• Hypotheses (h) and hypothesis spaces (H)
– Basic examples
– Version spaces and candidate elimination algorithm
• Next Thursday: Inductive Bias and Learning Decision Trees
Kansas State University
Department of Computing and Information SciencesCIS 730: Introduction to Artificial Intelligence
Specifying A Learning ProblemSpecifying A Learning Problem
• Learning = Improving with Experience at Some Task– Improve over task T,
– with respect to performance measure P,
– based on experience E.
• Example: Learning to Play Checkers– T: play games of checkers
– P: percent of games won in world tournament
– E: opportunity to play against self
• Refining the Problem Specification: Issues– What experience?
– What exactly should be learned?
– How shall it be represented?
– What specific algorithm to learn it?
• Defining the Problem Milieu– Performance element: How shall the results of learning be applied?
– How shall the performance element be evaluated? The learning system?
Kansas State University
Department of Computing and Information SciencesCIS 730: Introduction to Artificial Intelligence
Example (Revisited):Example (Revisited):Learning to Play Board GamesLearning to Play Board Games
• Type of Training Experience
– Direct or indirect?
– Teacher or not?
– Knowledge about the game (e.g., openings/endgames)?
• Problem: Is Training Experience Representative (of Performance Goal)?
• Software Design
– Assumptions of the learning system: legal move generator exists
– Software requirements: generator, evaluator(s), parametric target function
• Choosing a Target Function
– ChooseMove: Board Move (action selection function, or policy)
– V: Board R (board evaluation function)
– Ideal target V; approximated target
– Goal of learning process: operational description (approximation) of V
V̂
Kansas State University
Department of Computing and Information SciencesCIS 730: Introduction to Artificial Intelligence
Implicit RepresentationImplicit Representation in Learning: in Learning:Target Evaluation Function for CheckersTarget Evaluation Function for Checkers
• Possible Definition– If b is a final board state that is won, then V(b) = 100
– If b is a final board state that is lost, then V(b) = -100
– If b is a final board state that is drawn, then V(b) = 0
– If b is not a final board state in the game, then V(b) = V(b’) where b’ is the best final board state that can be achieved starting from b and playing optimally until the end of the game
– Correct values, but not operational
• Choosing a Representation for the Target Function– Collection of rules?
– Neural network?
– Polynomial function (e.g., linear, quadratic combination) of board features?
– Other?
• A Representation for Learned Function–
– bp/rp = number of black/red pieces; bk/rk = number of black/red kings; bt/rt = number of black/red pieces threatened (can be taken on next turn)
bwbwbwbwbwbww bV 6543210 rtbtrkbkrpbp ˆ
Kansas State University
Department of Computing and Information SciencesCIS 730: Introduction to Artificial Intelligence
Design Choices forDesign Choices forLearning to Play CheckersLearning to Play Checkers
Completed Design
Determine Type ofTraining Experience
Gamesagainst experts
Gamesagainst self
Table ofcorrect moves
DetermineTarget Function
Board valueBoard move
Determine Representation ofLearned Function
Polynomial Linear functionof six features
Artificial neuralnetwork
DetermineLearning Algorithm
Gradientdescent
Linearprogramming
Kansas State University
Department of Computing and Information SciencesCIS 730: Introduction to Artificial Intelligence
Performance ElementPerformance Element::What to Learn?What to Learn?
• Classification Functions– Hidden functions: estimating (“fitting”) parameters
– Concepts (e.g., chair, face, game)
– Diagnosis, prognosis: medical, risk assessment, fraud, mechanical systems
• Models– Map (for navigation)
– Distribution (query answering, aka QA)
– Language model (e.g., automaton/grammar)
• Skills– Playing games
– Planning
– Reasoning (acquiring representation to use in reasoning)
• Cluster Definitions for Pattern Recognition– Shapes of objects
– Functional or taxonomic definition
• Many Learning Problems Can Be Reduced to Classification
Kansas State University
Department of Computing and Information SciencesCIS 730: Introduction to Artificial Intelligence
Representations and Algorithms: Representations and Algorithms: How to Learn It?How to Learn It?
• Supervised
– What is learned? Classification function; other models
– Inputs and outputs? Learning:
– How is it learned? Presentation of examples to learner (by teacher)
• Unsupervised
– Cluster definition, or vector quantization function (codebook)
– Learning:
– Formation, segmentation, labeling of clusters based on observations, metric
• Reinforcement
– Control policy (function from states of the world to actions)
– Learning:
– (Delayed) feedback of reward values to agent based on actions selected; model
updated based on reward, (partially) observable state
xfxfx, ˆionapproximatexamples
xfx,xdx 21 codebook discretemetric distancensobservatio
as:pnir,si policy1 sequence rdstate/rewa i :
Kansas State University
Department of Computing and Information SciencesCIS 730: Introduction to Artificial Intelligence
(Supervised) Concept Learning(Supervised) Concept Learning
• Given: Training Examples <x, f(x)> of Some Unknown Function f
• Find: A Good Approximation to f
• Examples (besides Concept Learning)– Disease diagnosis
• x = properties of patient (medical history, symptoms, lab tests)
• f = disease (or recommended therapy)
– Risk assessment
• x = properties of consumer, policyholder (demographics, accident history)
• f = risk level (expected cost)
– Automatic steering
• x = bitmap picture of road surface in front of vehicle
• f = degrees to turn the steering wheel
– Part-of-speech tagging
– Fraud/intrusion detection
– Web log analysis
– Multisensor integration and prediction
Kansas State University
Department of Computing and Information SciencesCIS 730: Introduction to Artificial Intelligence
Example:Example:Supervised Inductive LearningSupervised Inductive Learning Problem Problem
UnknownFunction
x1
x2
x3
x4
y = f (x1, x2, x3, x4 )
• xi: ti, y: t, f: (t1 t2 t3 t4) t
• Our learning function: Vector (t1 t2 t3 t4 t) (t1 t2 t3 t4) t
Example x1 x2 x3 x4 y0 0 1 1 0 01 0 0 0 0 02 0 0 1 1 13 1 0 0 1 14 0 1 1 0 05 1 1 0 0 06 0 1 0 1 0
Kansas State University
Department of Computing and Information SciencesCIS 730: Introduction to Artificial Intelligence
Hypothesis Space:Hypothesis Space:Unrestricted CaseUnrestricted Case
• | A B | = | B | | A |
• |H4 H | = | {0,1} {0,1} {0,1} {0,1} {0,1} | = 224 = 65536 function values
• Complete Ignorance: Is Learning Possible?– Need to see every possible input/output pair
– After 7 examples, still have 29 = 512 possibilities (out of 65536) for fExample x1 x2 x3 x4 y
0 0 0 0 0 ?1 0 0 0 1 ?2 0 0 1 0 03 0 0 1 1 14 0 1 0 0 05 0 1 0 1 06 0 1 1 0 07 0 1 1 1 ?8 1 0 0 0 ?9 1 0 0 1 1
10 1 0 1 0 ?11 1 0 1 1 ?12 1 1 0 0 013 1 1 0 1 ?14 1 1 1 0 ?15 1 1 1 1 ?
Kansas State University
Department of Computing and Information SciencesCIS 730: Introduction to Artificial Intelligence
Example:Example:Learning A Concept (Learning A Concept (EnjoySportEnjoySport) from Data) from Data
Example Sky AirTemp
Humidity Wind Water Forecast EnjoySport
0 Sunny Warm Normal Strong Warm Same Yes1 Sunny Warm High Strong Warm Same Yes2 Rainy Cold High Strong Warm Change No3 Sunny Warm High Strong Cool Change Yes
• Specification for Training Examples– Similar to a data type definition
– 6 variables (aka attributes, features): Sky, Temp, Humidity, Wind, Water, Forecast
– Nominal-valued (symbolic) attributes - enumerative data type
• Binary (Boolean-Valued or H -Valued) Concept
• Supervised Learning Problem: Describe the General Concept
Kansas State University
Department of Computing and Information SciencesCIS 730: Introduction to Artificial Intelligence
Representing HypothesesRepresenting Hypotheses
• Many Possible Representations
• Hypothesis h: Conjunction of Constraints on Attributes
• Constraint Values
– Specific value (e.g., Water = Warm)
– Don’t care (e.g., “Water = ?”)
– No value allowed (e.g., “Water = Ø”)
• Example Hypothesis for EnjoySport
– Sky AirTemp Humidity Wind Water Forecast
<Sunny ? ? Strong ? Same>
– Is this consistent with the training examples?
– What are some hypotheses that are consistent with the examples?
Kansas State University
Department of Computing and Information SciencesCIS 730: Introduction to Artificial Intelligence
Typical Concept Learning TasksTypical Concept Learning Tasks
• Given– Instances X: possible days, each described by attributes Sky, AirTemp,
Humidity, Wind, Water, Forecast
– Target function c EnjoySport: X H {{Rainy, Sunny} {Warm, Cold} {Normal, High} {None, Mild, Strong} {Cool, Warm} {Same, Change}} {0, 1}
– Hypotheses H: conjunctions of literals (e.g., <?, Cold, High, ?, ?, ?>)
– Training examples D: positive and negative examples of the target function
• Determine– Hypothesis h H such that h(x) = c(x) for all x D
– Such h are consistent with the training data
• Training Examples– Assumption: no missing X values
– Noise in values of c (contradictory labels)?
mm,11, xcx,,xcx
Kansas State University
Department of Computing and Information SciencesCIS 730: Introduction to Artificial Intelligence
Inductive Learning HypothesisInductive Learning Hypothesis
• Fundamental Assumption of Inductive Learning
• Informal Statement
– Any hypothesis found to approximate the target function well over a sufficiently
large set of training examples will also approximate the target function well
over other unobserved examples
– Definitions deferred: sufficiently large, approximate well, unobserved
• Formal Statements, Justification, Analysis
– Statistical (Mitchell, Chapter 5; statistics textbook)
– Probabilistic (R&N, Chapters 14-15 and 19; Mitchell, Chapter 6)
– Computational (R&N, Section 18.6; Mitchell, Chapter 7)
• More on This Topic: Machine Learning and Pattern Recognition (CIS732)
• Next: How to Find This Hypothesis?
Kansas State University
Department of Computing and Information SciencesCIS 730: Introduction to Artificial Intelligence
Instances, Hypotheses, andInstances, Hypotheses, andthe Partial Ordering the Partial Ordering Less-Specific-ThanLess-Specific-Than
Instances X Hypotheses H
x1 = <Sunny, Warm, High, Strong, Cool, Same>x2 = <Sunny, Warm, High, Light, Warm, Same>
h1 = <Sunny, ?, ?, Strong, ?, ?>h2 = <Sunny, ?, ?, ?, ?, ?>h3 = <Sunny, ?, ?, ?, Cool, ?>
h2 P h1
h2 P h3
x1
x2
Specific
General
h1 h3
h2
P Less-Specific-Than More-General-Than
Kansas State University
Department of Computing and Information SciencesCIS 730: Introduction to Artificial Intelligence
Find-SFind-S Algorithm Algorithm
1. Initialize h to the most specific hypothesis in H
H: the hypothesis space (partially ordered set under relation Less-Specific-Than)
2. For each positive training instance x
For each attribute constraint ai in h
IF the constraint ai in h is satisfied by x
THEN do nothing
ELSE replace ai in h by the next more general constraint that is satisfied by x
3. Output hypothesis h
Kansas State University
Department of Computing and Information SciencesCIS 730: Introduction to Artificial Intelligence
Hypothesis SpaceHypothesis Space Search Searchby by Find-SFind-S
Instances X
Hypotheses H
x1 = <Sunny, Warm, Normal, Strong, Warm, Same>, +x2 = <Sunny, Warm, High, Strong, Warm, Same>, +x3 = <Rainy, Cold, High, Strong, Warm, Change>, -x4 = <Sunny, Warm, High, Strong, Cool, Change>, +
h1 = <Ø, Ø, Ø, Ø, Ø, Ø> h2 = <Sunny, Warm, Normal, Strong, Warm, Same>h3 = <Sunny, Warm, ?, Strong, Warm, Same>h4 = <Sunny, Warm, ?, Strong, Warm, Same>h5 = <Sunny, Warm, ?, Strong, ?, ?>
• Shortcomings of Find-S
– Can’t tell whether it has learned concept
– Can’t tell when training data inconsistent
– Picks a maximally specific h (why?)
– Depending on H, there might be several!
h1
h0
h2,3
h4
-
+
++
x3
x1 x2
x4
Kansas State University
Department of Computing and Information SciencesCIS 730: Introduction to Artificial Intelligence
Version SpacesVersion Spaces
• Definition: Consistent Hypotheses
– A hypothesis h is consistent with a set of training examples D of target concept
c if and only if h(x) = c(x) for each training example <x, c(x)> in D.
– Consistent (h, D) <x, c(x)> D . h(x) = c(x)
• Definition: Version Space
– The version space VSH,D , with respect to hypothesis space H and training
examples D, is the subset of hypotheses from H consistent with all training
examples in D.
– VSH,D { h H | Consistent (h, D) }
Kansas State University
Department of Computing and Information SciencesCIS 730: Introduction to Artificial Intelligence
1. Initialization
G (singleton) set containing most general hypothesis in H, denoted {<?, … , ?>}
S set of most specific hypotheses in H, denoted {<Ø, … , Ø>}
2. For each training example d
If d is a positive example (Update-S)
Remove from G any hypotheses inconsistent with d
For each hypothesis s in S that is not consistent with d
Remove s from S
Add to S all minimal generalizations h of s such that
1. h is consistent with d
2. Some member of G is more general than h
(These are the greatest lower bounds, or meets, s d, in VSH,D)
Remove from S any hypothesis that is more general than another hypothesis
in S (remove any dominated elements)
Candidate Elimination Algorithm [1]Candidate Elimination Algorithm [1]
Kansas State University
Department of Computing and Information SciencesCIS 730: Introduction to Artificial Intelligence
Candidate Elimination Algorithm [2]Candidate Elimination Algorithm [2]
(continued)
If d is a negative example (Update-G)
Remove from S any hypotheses inconsistent with d
For each hypothesis g in G that is not consistent with d
Remove g from G
Add to G all minimal specializations h of g such that
1. h is consistent with d
2. Some member of S is more specific than h
(These are the least upper bounds, or joins, g d, in VSH,D)
Remove from G any hypothesis that is less general than another hypothesis in
G (remove any dominating elements)
Kansas State University
Department of Computing and Information SciencesCIS 730: Introduction to Artificial Intelligence
<Sunny, Warm, ?, Strong, Warm, Same>S2
= G2
Example TraceExample Trace
<Ø, Ø, Ø, Ø, Ø, Ø>S0
<?, ?, ?, ?, ?, ?>G0
d1: <Sunny, Warm, Normal, Strong, Warm, Same, Yes>
d2: <Sunny, Warm, High, Strong, Warm, Same, Yes>
d3: <Rainy, Cold, High, Strong, Warm, Change, No>
d4: <Sunny, Warm, High, Strong, Cool, Change, Yes>= S3
<Sunny, ?, ?, ?, ?, ?> <?, Warm, ?, ?, ?, ?> <?, ?, ?, ?, ?, Same>G3
<Sunny, ?, ?, Strong, ?, ?> <Sunny, Warm, ?, ?, ?, ?> <?, Warm, ?, Strong, ?, ?>
<Sunny, Warm, ?, Strong, ?, ?>S4
G4 <Sunny, ?, ?, ?, ?, ?>
<?, Warm, ?, ?, ?, ?>
<Sunny, Warm, Normal, Strong, Warm, Same>S1
= G1
Kansas State University
Department of Computing and Information SciencesCIS 730: Introduction to Artificial Intelligence
Summary PointsSummary Points
• Taxonomies of Learning
• Definition of Learning: Task, Performance Measure, Experience
• Concept Learning as Search through H
– Hypothesis space H as a state space
– Learning: finding the correct hypothesis
• General-to-Specific Ordering over H
– Partially-ordered set: Less-Specific-Than (More-General-Than) relation
– Upper and lower bounds in H
• Version Space Candidate Elimination Algorithm
– S and G boundaries characterize learner’s uncertainty
– Version space can be used to make predictions over unseen cases
• Learner Can Generate Useful Queries
• Next Tuesday: When and Why Are Inductive Leaps Possible?
Kansas State University
Department of Computing and Information SciencesCIS 730: Introduction to Artificial Intelligence
TerminologyTerminology
• Supervised Learning– Concept - function from observations to categories (so far, boolean-valued: +/-)
– Target (function) - true function f
– Hypothesis - proposed function h believed to be similar to f
– Hypothesis space - space of all hypotheses that can be generated by the learning system
– Example - tuples of the form <x, f(x)>
– Instance space (aka example space) - space of all possible examples
– Classifier - discrete-valued function whose range is a set of class labels
• The Version Space Algorithm– Algorithms: Find-S, List-Then-Eliminate, candidate elimination
– Consistent hypothesis - one that correctly predicts observed examples
– Version space - space of all currently consistent (or satisfiable) hypotheses
• Inductive Learning– Inductive generalization - process of generating hypotheses that describe
cases not yet observed
– The inductive learning hypothesis