Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
29 views

02-Regression-I Machine Learning

The document discusses different types of machine learning including supervised, unsupervised, semi-supervised, and reinforcement learning. It provides examples of supervised learning problems including classification, where the target variables are discrete, and regression, where the target variables are continuous. Regression examples provided include predicting housing prices from size and predicting angles of a robot arm from position.

Uploaded by

Ali Don
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
29 views

02-Regression-I Machine Learning

The document discusses different types of machine learning including supervised, unsupervised, semi-supervised, and reinforcement learning. It provides examples of supervised learning problems including classification, where the target variables are discrete, and regression, where the target variables are continuous. Regression examples provided include predicting housing prices from size and predicting angles of a robot arm from position.

Uploaded by

Ali Don
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 31

CS 4104

APPLIED MACHINE LEARNING

Dr. Hashim Yasin


National University of Computer
and Emerging Sciences,
Faisalabad, Pakistan.
LEARNING
Learning Types
3

Learning may be:


❑ Supervised Learning
❑ Unsupervised Learning
❑ Semi-supervised Learning
❑ Reinforcement Learning

Dr. Hashim Yasin Applied Machine Learning (CS4104)


Supervised Learning
4

 In supervised learning, the agent observes some


example input–output pairs and learns a function
that maps from input to output.
 Supervised learning involves:
 input features
 target features

 training examples

Dr. Hashim Yasin Applied Machine Learning (CS4104)


Supervised Learning
5

 The training examples


 where the input features as well as the target features are
specified.

 We have to predict the target features of a new


example for which the input features are given.

 This is called,
 classification when the target variables are discrete and
 regression when the target features are continuous.

Dr. Hashim Yasin Applied Machine Learning (CS4104)


Supervised Learning
6

 Given a data set (training data)


𝐷= 𝑥1 , 𝑦1 , 𝑥2 , 𝑦2 , … 𝑥𝑚 , 𝑦𝑚

Inputs Outputs
 Goal: Find a hypothesis ℎ in hypothesis class 𝐻 that performs
a good job of mapping 𝑥 to 𝑦.

 When 𝑦𝑖 is a boolean, or a member of a discrete set, the


problem is a classification problem. When 𝑦𝑖 is real-valued,
we call this a regression problem.
Dr. Hashim Yasin Applied Machine Learning (CS4104)
Unsupervised Learning
7

 In unsupervised learning, the agent learns patterns


in the input even though no explicit feedback is
supplied.
 Unsupervised learning occurs when no
classifications are given and the learner must
discover categories and regularities in the data.
 The most general example of unsupervised learning
task is clustering:
 potentially useful clusters developed from the input
examples.

Dr. Hashim Yasin Applied Machine Learning (CS4104)


Unsupervised Learning
8

Supervised
Learning

x2 Unsupervised
Learning

x1

Dr. Hashim Yasin Applied Machine Learning (CS4104)


Semi-Supervised Learning
9

 In semi-supervised learning we are given a few


labeled examples and must make what we can of a
large collection of unlabeled examples.

 Some data is labeled but most of it is unlabeled and a


mixture of supervised and unsupervised techniques can
be used.

 Many real world machine learning problems fall into


this type of learning.
Dr. Hashim Yasin Applied Machine Learning (CS4104)
Reinforcement Learning
10

 A supervised learning agent needs to be told the correct


move for each position it encounters, but such feedback
is seldom available.

 In the absence of feedback, an agent can learn a


transition model for its own moves and can perhaps
learn to predict the opponent’s moves,

 Without some feedback about what is good and what is


bad, the agent will have no grounds for deciding which
move to make.
Dr. Hashim Yasin Applied Machine Learning (CS4104)
Reinforcement Learning
11

 In reinforcement learning the agent learns from a


series of reinforcements—rewards or punishments.

 A win at the end of a chess game tells the agent it


did something right.
 Itis up to the agent to decide which of the actions prior
to the reinforcement were most responsible for it.

 The rewards may come more frequently, it


depends upon the environment.
Dr. Hashim Yasin Applied Machine Learning (CS4104)
Reinforcement Learning
12

 Each percept(e) is enough to determine the State(the


state is accessible)
 The agent can decompose the reward component
from a percept.
 The agent task: to find an optimal policy, mapping
states to actions, that maximize long-run measure of
the reinforcement
 Think of reinforcement as reward
 Can be modeled as Markov Decision Processes MDP
model!

Dr. Hashim Yasin Applied Machine Learning (CS4104)


Reinforcement Learning
13

 Applications:
 Game playing
 Robot in a maze

 Multiple agents, partial observability, ...

Dr. Hashim Yasin Applied Machine Learning (CS4104)


REGRESSION VS
CLASSIFICATION
Classification
15

Classification
Predict discrete‐valued output
 Example: Credit scoring
 Differentiating between low-
risk and high-risk customers
from their income and savings
Discriminant Model:
IF income > θ1 AND savings > θ2
THEN low-risk
ELSE high-risk

Dr. Hashim Yasin Applied Machine Learning (CS4104)


Classification … Applications
16

 Aka Pattern recognition


 Face recognition: Pose, lighting, occlusion (glasses,
beard), make-up, hair style
 Character recognition: Different handwriting styles.
 Speech recognition: Temporal dependency.
 Use of a dictionary or the syntax of the language.
 Sensor fusion: Combine multiple modalities; eg, visual
(lip image) and acoustic for speech
 Medical diagnosis: From symptoms to illnesses
 Web Advertising: Predict if a user clicks on an ad
on the Internet.
Dr. Hashim Yasin Applied Machine Learning (CS4104)
Regression
17

Regression
 Predict real-valued output

Examples: Price of a Used Car


 Inputs: are the car attributes—brand, year, engine
capacity, mileage, and other information—that may
affect a car’s price.
 Output: is the price of the car.

 Such problems where the output is a number, are


regression problems.

Dr. Hashim Yasin Applied Machine Learning (CS4104)


Regression Example
18

 X: car attributes (input


variables)
 Y: the price of the car 𝑦 = 𝜃0 + 𝜃1 𝑥
(target/output variables)

y: Price
 Learn the program that fits
the function to training
examples to learn Y as the
function of X.

𝒚 = 𝜽𝟎 + 𝜽𝟏 𝒙
x: Mileage

Dr. Hashim Yasin Applied Machine Learning (CS4104)


Regression Examples
19

 Navigating a car: Angle of the steering


 Kinematics of a robot arm

(x,y) α1= g1(x,y)


α2= g2(x,y)
α2

α1

◼ Response surface design

Dr. Hashim Yasin Applied Machine Learning (CS4104)


Error Measure
20

Classification
 Y is discrete, a (small) finite, unordered set of classes

𝑒𝑟𝑟𝑜𝑟 ℎ 𝑥 , 𝑓 𝑥 = 0 if ℎ 𝑥 = 𝑓 𝑥 else 1
0-1 Loss Error
Regression
 Y is continuous, a numeric set (typically real numbers)
𝑒𝑟𝑟𝑜𝑟 ℎ 𝑥 , 𝑓 𝑥 = (ℎ 𝑥 − 𝑓 𝑥 )2
Squared Error
Dr. Hashim Yasin Applied Machine Learning (CS4104)
LINEAR REGRESSION
Linear Regression with one Variable
22

Housing Prices
(Portland, OR)

of dollars)
(in 1000s
Price

Size (feet2)
Supervised Learning Regression Problem
Given the “right answer” for Predict real-valued output
each example in the data.
Dr. Hashim Yasin Applied Machine Learning (CS4104)
Regression Example
23

Training set of Size in feet2 (x) Price ($) in 1000's (y)


housing prices 2104 460
1416 232
1534 315
852 178
… …
Notation:
m = Number of training examples One Training example 𝑥, 𝑦
x’s = “input” variable / features 𝑖𝑡ℎ training example (𝑥 𝑖 , 𝑦 𝑖 )
y’s = “output” variable / “target” variable

Dr. Hashim Yasin Applied Machine Learning (CS4104)


Regression
24

Training Set

Learning Algorithm

Size of Estimated
house (X)
h price (Y)

Question : How to describe h?


ℎ: 𝑋 → 𝑌
Dr. Hashim Yasin Applied Machine Learning (CS4104)
Regression Example
25

Training set of Size in feet2 (x) Price ($) in 1000's (y)


housing prices 2104 460
1416 232
1534 315
852 178
… …

Hypothesis:
‘s: Parameters
How to choose ‘s ?
Dr. Hashim Yasin Applied Machine Learning (CS4104)
Regression
26

 How to choose these parameters , 𝜃 (regression


coefficient)?

 The standard approach is the least square method,


through which parameters are minimized

 The machine learning program optimizes the


parameters, 𝜃, such that the approximation error is
minimized.
Dr. Hashim Yasin Applied Machine Learning (CS4104)
Regression
27

𝑐ℎ𝑎𝑛𝑔𝑒 𝑖𝑛 𝑌
𝑦 = 𝜃0 + 𝜃1 𝑥 𝜃=
𝑐ℎ𝑎𝑛𝑔𝑒 𝑖𝑛 𝑋

𝜃1 = 0.5, 𝜃0 = 1 𝜃1 = 0, 𝜃0 = 1.5

Dr. Hashim Yasin Applied Machine Learning (CS4104)


Regression
28

𝑐ℎ𝑎𝑛𝑔𝑒 𝑖𝑛 𝑌
𝑦 = 𝜃1 𝑥 + 𝜃0 𝜃=
𝑐ℎ𝑎𝑛𝑔𝑒 𝑖𝑛 𝑋

𝜃1 = 2, 𝜃0 = 1 𝜃1 = 1, 𝜃0 = 0

Dr. Hashim Yasin Applied Machine Learning (CS4104)


Regression
29

Idea: Choose so that


is close to for our
training examples

Dr. Hashim Yasin Applied Machine Learning (CS4104)


Cost Function
30

Simplified:
Hypothesis:

Parameters:

Cost Function:

Goal:

Dr. Hashim Yasin Applied Machine Learning (CS4104)


Acknowledgement
31

Tom Mitchel, Russel & Norvig, Andrew Ng, Alpydin &


Ch. Eick.

Dr. Hashim Yasin Applied Machine Learning (CS4104)

You might also like