52
Greg Grudic Machine Learning 1 Machine Learning CSCI 5622 Spring 2008 Greg Grudic

Machine Learning CSCI 5622

  • Upload
    butest

  • View
    464

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Machine Learning CSCI 5622

Greg Grudic Machine Learning 1

Machine Learning CSCI 5622Spring 2008

Greg Grudic

Page 2: Machine Learning CSCI 5622

Greg Grudic Machine Learning 2

Admin Stuff 1Location: Wednesdays 3:00pm-5:30pm ECCR 131

Instructor: Professor Greg GrudicOffice: ECOT 525Office Hours: Tuesday and Thursday 2:00 to 3:00

And By AppointmentPhone: 303-492-4419Email: [email protected] URL: http://www.cs.colorado.edu/~grudic/teaching/CSCI5622_20

08_S

Page 3: Machine Learning CSCI 5622

Greg Grudic Machine Learning 3

Admin Stuff 2• Course Textbook: There isn’t one….

– However, if you plan to use ML after you finish the course, I recommend: The Elements of Statistical Learning, by Hastie, Tibshirani, Friedman

• Grading:– Homework 50%– Project 20%– Class participation 7%– Final Exam 20%– Random Quizzes 3%

• Course workload outside of class? – 4 to 5 hours per week.

Page 4: Machine Learning CSCI 5622

Greg Grudic Machine Learning 4

Admin Stuff 3• Homework

– 6 coding assignments (algorithm implementation). – YOU MUST USE MATLAB!!!– Unless you have a very good excuse, each day your assignment is late will take

1% off what the assignment is worth.• Final Exam

– Test basic knowledge of ML. It will consist of general questions on the machine learning algorithms covered to date. You will likely not be required to derive algorithms or prove theorems.

• Project (Pick by March 1)– Consists of building models from data I provide. Or a topic of your choice…– Please email me your project topic by March 1 for approval.

• Class participation– This consists of showing up for class and asking questions. Questions by email

count as class participation, but will generally be answered in class (unless you need an answer ASAP).

• Random Quizzes– There will be a few of these. Based on material covered in class. If you pay

attention, these will be easy…

Page 5: Machine Learning CSCI 5622

Greg Grudic Machine Learning 5

Class Textbook?

• Unfortunately, no single text covers everything we do in this class– So I will attempt to give you very good notes!

• One good text is:– The Elements of Statistical Learning, by Hastie,

Tibshirani, Friedman

Page 6: Machine Learning CSCI 5622

Greg Grudic Machine Learning 6

Goal of the Course

• A fundamental understanding of the basic concepts behind Machine Learning (ML)– What does it mean for a machine to learn?

• You will be able to read current research papers in ML after completing this course

Why is Machine Learning important?– ML algorithms are at the heart of many modern

computer applications– ML is also at the heart of AI

Page 7: Machine Learning CSCI 5622

What is AI?

Views of AI fall into four categories:

Thinking humanly Thinking rationally Acting humanly Acting rationally

Warning, I advocate for “acting rationally” based on Machine Learning – but I am willing to hear other arguments and change my mind

Greg Grudic 7Introduction to AI

Page 8: Machine Learning CSCI 5622

Acting humanly: Turing Test• Turing (1950) "Computing machinery and intelligence":• "Can machines think?" "Can machines behave intelligently?"• Operational test for intelligent behavior: the Imitation Game

• Predicted that by 2000, a machine might have a 30% chance of fooling a lay person for 5 minutes

• Anticipated all major arguments against AI in following 50 years• Suggested major components of AI: knowledge, reasoning, language

understanding, learningGreg Grudic 8Introduction to AI

Page 9: Machine Learning CSCI 5622

Thinking humanly: cognitive modeling

• 1960s "cognitive revolution": information-processing psychology

• Requires scientific theories of internal activities of the brain– How to validate? Requires

1) Predicting and testing behavior of human subjects (top-down), or 2) Direct identification from neurological data (bottom-up)

• Both approaches (roughly, Cognitive Science and Cognitive Neuroscience) are now distinct from AI

Greg Grudic 9Introduction to AI

Page 10: Machine Learning CSCI 5622

Thinking Rationally: "laws of thought"

• Aristotle: what are correct arguments/thought processes?

• Several Greek schools developed various forms of logic: notation and rules of derivation for thoughts; may or may not have proceeded to the idea of mechanization

• Direct line through mathematics and philosophy to modern AI

• Problems: 1. Not all intelligent behavior is mediated by logical deliberation2. What is the purpose of thinking? What thoughts should I have?3. Should thinking need to be associated with actions?

Greg Grudic 10Introduction to AI

Page 11: Machine Learning CSCI 5622

Acting rationally: rational agent

• Rational behavior: doing the right thing

• The right thing: that which is expected to maximize goal achievement, given the available information– Problem: How do we know the agent is doing this?

• Doesn't necessarily involve thinking – e.g., blinking reflex – but thinking should be in the service of rational action

Greg Grudic 11Introduction to AI

Page 12: Machine Learning CSCI 5622

Rational agents• An agent is an entity that perceives and acts

• This course is about designing rational agents

• Abstractly, an agent is a function from percept histories to actions:

[f: P* A]

• For any given class of environments and tasks, we seek the agent (or class of agents) with the best performance

• Caveats:– computational limitations make perfect rationality unachievable

• design best program for given machine resource– Can we ever know if an agent is acting rationally?

Greg Grudic 12Introduction to AI

Page 13: Machine Learning CSCI 5622

Greg Grudic Introduction to AI 13

My Personal View of AI• I want to build a robot that will

– Clean my house– Cook when I don’t want to– Wash my clothes– Cut my grass– Fix my car (or take it to be fixed)– i.e. do the things that I don’t feel like doing…

• Therefore: AI is (to me) the science of building machines (agents) that act rationally with respect to a goal.

Page 14: Machine Learning CSCI 5622

Greg Grudic Introduction to AI 14

World

Agent

Sensing

Computation

Action

•physical world•robotics

•Internet•Computer program

•game

•data received fromthe world

•Plan actions based onsensor observations andthe results of previousactions

•“Move” the agent to some new state in the worlds

Agent: sensing, computation, and action

Page 15: Machine Learning CSCI 5622

Greg Grudic Introduction to AI 15

What is a Rational Agent?

• An agent is an entity that senses, computes and acts in some world

• A rational agent is one that does the right thing– The right thing: that which is expected to maximize

goal achievement (accomplishing tasks that Greg doesn’t feel like doing), given the available information

• This is not a new idea: – Aristotle (Nicomachean Ethics): Every art and every

inquiry, and similarly every action and pursuit, is thought to aim at some good

Page 16: Machine Learning CSCI 5622

Greg Grudic Introduction to AI 16

Elements of AI

Learning

ReasoningRepresentation

Page 17: Machine Learning CSCI 5622

Greg Grudic Introduction to AI 17

(My) Elements of AI

Learning

ReasoningRepresentation

Page 18: Machine Learning CSCI 5622

Greg Grudic Introduction to AI 18

Why Must Representation and Reasoning be Encompassed by

Learning?• Fundamental lesson of AI (learned in the 1980’s):

– It is not possible to hand code knowledge about anything but closed problem domains (like photocopier repair)!

• Uncertainty is a key problem!– Expert Systems: largely failed because:

• An expert (e.g. doctor) doesn’t know how to formalize (code) what makes her an expert!

• Evan closed systems like photocopier repair programes are to expensive to hand code.

– For Example: I’m an expert on chairs but I can’t (and no one can!) write a program that identifies chairs in an image

• However, ML techniques can!• How can I reason rationally about a world I cannot encode

knowledge about?• I do not believe that an agent can gain knowledge about a world

without sampling it and learning from those samples….

Page 19: Machine Learning CSCI 5622

AI Agent: A Different Perspective

Greg Grudic Introduction to AI 19

world

Sensing Actions

Computation

State

Decisions/PlanningAgent

Uncertainty

Signals

Symbols(The

GroundingProblem)

Not typically addressed in CS

Page 20: Machine Learning CSCI 5622

Greg Grudic Introduction to AI 20

Why is Machine Learning Important?

• Machine Learning is a Principled Methodology for dealing with uncertainty (noise) in– world– sensors– computation– action

Page 21: Machine Learning CSCI 5622

Greg Grudic Introduction to AI 21

Where can Machine Learning Algorithms be Found?

• Marketing– Who should a company target for advertising?

• Profiling– Is passenger 57 likely to hijack the plane?

• User interfaces– Making it easier to interact with a PC by anticipating what I am doing.

• Document characterization– Searching the web for things of interest.

• Bioinformatics– Human genome project

• Which gene is responsible for the cancer that runs in my family?• Data mining

– “Data doubles every year”, Dunham 2002– ML algorithms are used to make sense of this data

• Economics, medical diagnosis, robotics, computer vision, manufacturing, inventory control, elevator operation….

Page 22: Machine Learning CSCI 5622

Greg Grudic Introduction to AI 22

What is Machine Learning?

• “The goal of machine learning is to build computer systems that can adapt and learn from their experience.”– Tom Dietterich

• What does this mean?• When are ML algorithms NOT needed?

Page 23: Machine Learning CSCI 5622

Greg Grudic Introduction to AI 23

A Generic System (Agent?)

System… …1x2x

Nx

1y2y

My1 2, , ..., Kh h h

( )1 2, ,..., Nx x x=x( )1 2, ,..., Kh h h=h( )1 2, ,..., Ky y y=y

Input Variables:Hidden Variables:

Output Variables:

Page 24: Machine Learning CSCI 5622

Greg Grudic Introduction to AI 24

Another Definition of Machine Learning

• Machine Learning algorithms discover the relationships between the variables of a system (input, output and hidden) from direct samples of the system

• These algorithms originate form many fields:– Statistics, mathematics, theoretical computer science,

physics, neuroscience, etc

Page 25: Machine Learning CSCI 5622

Greg Grudic Introduction to AI 25

When are ML algorithms NOT needed?

• When the relationships between all relevant system variables (input, output, and hidden) is adequately understood!

• This is NOT the case for many complex real systems!

Page 26: Machine Learning CSCI 5622

Greg Grudic Introduction to AI 26

Main Subfields of Machine Learning• Supervised learning

– Classification– Regression

• Semi-Supervised (Transduction) learning• Active learning• Reinforcement Learning• Unsupervised Learning

Page 27: Machine Learning CSCI 5622

Greg Grudic Machine Learning 27

Supervised Learning

• Given: Training examples

of some unknown function (system)

• Find (i.e. an approximation)– Predict , where is not in the

training set

( )( ) ( )( ) ( )( ){ }1 1 2 2, , , ,..., ,P Px f x x f x x f x

( )=y f x

( )f̂ x( )ˆy f x′ ′= ′x

Page 28: Machine Learning CSCI 5622

Greg Grudic Machine Learning 28

Two Types of Supervised Learning

• Classification– Model output is a prediction that the input

belongs to some class– If the input is an image, the output might be

chair, face, dog, boat,… etc.• Regression

– The output has infinitely many values– If the input is stock features, the output could

be a prediction of tomorrow’s stock price

{ }1 2, ,..., Nc c cy∈

y∈ℜ

Page 29: Machine Learning CSCI 5622

Greg Grudic Machine Learning 29

Learning Classification Models• Collect Training data• Build Model: happy = F(feature space)• Make a prediction

HighDimensional

Feature (input)Space

Page 30: Machine Learning CSCI 5622

Greg Grudic Machine Learning 30

Learning Regression Models• Collect Training data• Build Model: stock value = F(feature space)• Make a prediction

Feature (input) Space

StockValue

**

** ** ** *

***

****

*** *

* ** ****

**

*** *

* ** ***

**

Page 31: Machine Learning CSCI 5622

Greg Grudic Machine Learning 31

Examples of Supervised Learning

( )f x

x• Credit risk assessment

: Properties of customer and proposed purchase

: Approve purchase (loan) or not

( )f x

x• Disease diagnosis

: Properties of patient (symptoms, lab tests)

: Disease (or maybe, recommended therapy)

Page 32: Machine Learning CSCI 5622

Greg Grudic Machine Learning 32

Examples of Supervised Learning (continued)

( )f x

x• Face recognition

: Image of person's face

: Name of the person

( )f x

x• Automated Vehicle Driving

: Image of the road

: Throttle, break, and steering commands

Page 33: Machine Learning CSCI 5622

Greg Grudic Machine Learning 33

• Situations where humans can perform the task but can't describe how they do it

Appropriate Applications for Supervised Learning

( )f x

x• Situations where there is no human expert

: Bond graph for a new molecule

: Predicted binding strength to AIDS protease molecule

( )f x

x : Bitmap picture of hand-written character

: Ascii code of the character

Page 34: Machine Learning CSCI 5622

Greg Grudic Machine Learning 34

• Situations where each user needs a customized function f

Appropriate Applications for Supervised Learning (continued)

( )f xx

• Situations where the desired function is changing frequently

: Description of stock prices : Recommended stock transactions

( )f x

x : Incoming email message

: Importance score for presenting to user (or deleting without presenting)

Page 35: Machine Learning CSCI 5622

Greg Grudic Machine Learning 35

An Example of Classification for Robotics

Page 36: Machine Learning CSCI 5622

Classification in the 8 to 100 meter Range

1/16/2008 University of Colorado 36

Page 37: Machine Learning CSCI 5622

Greg Grudic Machine Learning 37

Semi-Supervised Learning (Transduction)

• Given: Training examples

of some unknown function (system)• And examples of inputs that require

classification• Predict

( )( ) ( )( ) ( )( ){ }1 1 2 2, , , ,..., ,P Px f x x f x x f x( )=y f x

( ) ( ) ( ){ }1 2, ,..., kx x x′ ′ ′

( )( ) ( )( ) ( )( ){ }1 1 2 2ˆ ˆ ˆ, ,..., k ky f x y f x y f x′ ′ ′ ′ ′ ′= = =

Page 38: Machine Learning CSCI 5622

Greg Grudic Machine Learning 38

Semi-Supervised Learning (Transduction) 2 (from Learning with Local and Global Consistency

Dengyong Zhou, Olivier Bousquet, Thomas N. Lal, Jason Weston, Bernhard Schoelkopf, NIPS 2003)

Page 39: Machine Learning CSCI 5622

When is Semi-Supervised Learning Appropriate

• When labeling examples is expensive– Bioinformatics

• Experiments are expensive

– Marketing• People don’t like responding to surveys

– …

Greg Grudic Machine Learning 39

Page 40: Machine Learning CSCI 5622

Greg Grudic Machine Learning 40

• Premise: Data is expensive to collect (e.g most experiments in biology)• Goal: want to get the best possible model with the smallest dataset• Active learning starts with a classifier and asks the following question

– Where in the feature (input) space do I need to sample next to improve my classifier the most?

HighDimensional

Feature (input)Space

Active Learning

??

?

Page 41: Machine Learning CSCI 5622

When is Active Learning Appropriate?

• When even unlabelled training data is expensive to get!– Bioinformatics

• Biological experiments are expensive!

– …

Greg Grudic Machine Learning 41

Page 42: Machine Learning CSCI 5622

Greg Grudic Machine Learning 42

Reinforcement Learning (RL)

Autonomous agent learns to act “optimally” without human intervention

• Agent learns by stochastically interacting with its environment, getting infrequent rewards

• Goal: maximize infrequent reward

Page 43: Machine Learning CSCI 5622

Greg Grudic Machine Learning 43

Reinforcement Learning

• Addresses the temporal credit assignment problem:– Delayed reward (HARD problem!)

• Successful RL applications:– TD gammon (Tesauro)– Packing containers (Moore)– Elevator dispatch (Crites and Barto)

Page 44: Machine Learning CSCI 5622

Greg Grudic Machine Learning 44

RL in RoboticsGoal

Robot

Obstacle

Static Navigational

Feature

-Hit an obstacle: get a negative reward-Reach goal: get a positive reward-Reach goal faster: get a bigger positive reward

Page 45: Machine Learning CSCI 5622

When is Reinforcement Learning Useful?

• When you don’t have input and output examples of the model being learned.

• However, there is periodic positive and negative feedback from the envirnment.

Greg Grudic Machine Learning 45

Page 46: Machine Learning CSCI 5622

Greg Grudic Machine Learning 46

Unsupervised Learning(Clustering)

• Studies how input patterns can be represented to reflect the statistical structure of the overall collection of input patterns

• No outputs are used (unlike supervised learning and reinforcement learning)

• Unsupervised learner brings to bear prior biases as to what aspects of the structure of the input should be captured in the output

Page 47: Machine Learning CSCI 5622

Greg Grudic Machine Learning 47

Unsupervised Learning Examples(Clustering)

HighDimensional

FeatureSpace

*** ** *

**

**

***

*** ** *** ** *** **

• Collect Training data (e.g. consumer info)• Build Model: things that a similar = M (feature

space)

Page 48: Machine Learning CSCI 5622

Greg Grudic Machine Learning 48

Locally Linear Embedding (LLE)

From:Sam T. Roweis

[email protected]/~roweis/

andLawrence K. Saul

[email protected]/~lsaul/

Page 49: Machine Learning CSCI 5622

When is Unsupervised Learning Useful?

• You don’t have labels.• You need to identify the underlying

structure of the data – e.g. Clustering.

Greg Grudic Machine Learning 49

Page 50: Machine Learning CSCI 5622

Greg Grudic Machine Learning 50

Image 1 Image 1: Poly Mahalanobis

Image 2

- Level of darkness is proportional to confidence in labeled path- White areas indicate no path- Path threshold chosen through cross validation

Outdoor Path LabelingImage patches used to construct models

Features: 10 by 10 window of normalized rgb pixels (d = 300)

Euclidean Mahalanobis Poly Mahalanobis

Page 51: Machine Learning CSCI 5622

Greg Grudic Machine Learning 51

Image 4

Image 6

Image 3

Euclidean Mahalanobis Poly Mahalanobis

Page 52: Machine Learning CSCI 5622

Greg Grudic Machine Learning 52

Conclusion

• How many people have I scared away?– Why?