34
Machine Learning Introduction Study on the Coursera All Right Reserved : Andrew Ng Lecturer:Mu ch Database Lab of Xiamen University Aug 12,2014

Machine Learning Introduction

Embed Size (px)

DESCRIPTION

Machine Learning Introduction. Study on the Coursera All Right Reserved : Andrew Ng Lecturer: Much Database Lab of X iamen University. Aug 12,2014. Examples: Database mining Large datasets from growth of automation/web. - PowerPoint PPT Presentation

Citation preview

Page 1: Machine Learning  Introduction

Machine Learning Introduction

Study on the CourseraAll Right Reserved : Andrew Ng

Lecturer:Much Database Lab of Xiamen University

Aug 12,2014

Page 2: Machine Learning  Introduction

• Examples: - Database mining

• Large datasets from growth of automation/web. • Web click data, medical records, biology, engineering

- Applications can’t program by hand.• Handwriting recognition, most of Natural Language

Processing (NLP), Computer Vision.

• Machine Learning- Grew out of work in AI(Artificial Intelligence)- New capability for computers

Page 3: Machine Learning  Introduction

Machine Learning Definition

• Tom Mitchell (1998) Well-posed Learning Problem:

A computer program is said to learn from experience E with respect to some task T and some performance measure P, if its performance on T, as measured by P, improves with experience E.

Page 4: Machine Learning  Introduction

• Suppose your email program watches which emails you do or do not mark as spam, and based on that learns how to better filter spam. What is the task T in this setting? T : Classifying emails as spam or not spam

E : Watching you label emails as spam or not spam

P: The number of emails correctly classified as spam/not spam

“A computer program is said to learn from experience E with respect to some task T and some performance measure P, if its performance on T, as measured by P, improves with experience E.”

Page 5: Machine Learning  Introduction

Machine Learning Algorithms

- Supervised learning- Unsupervised learning

- Others:- Reinforcement learning- Recommender systems.

Page 6: Machine Learning  Introduction

x1

x2

Supervised Learning & Unsupervised Learning

Supervised Learning Unsupervised Learning

Page 7: Machine Learning  Introduction

Linear Regression with one Variable

Housing Prices(Portland, OR)

Price(in 1000s of dollars)

Size (feet2)

Supervised Learning

Given the “right answer” for each example in the data.

Regression Problem

Predict real-valued output

Page 8: Machine Learning  Introduction

Notation:

m = Number of training examples

x’s = “input” variable / features

y’s = “output” variable / “target” variable

Size in feet2 (x) Price ($) in 1000's (y)2104 4601416 2321534 315852 178… …

Training set ofhousing prices

Training Set

Learning Algorithm

hSize of house

Estimated price

Question : How to describe h?

Page 9: Machine Learning  Introduction

How to choose ‘s ?

Training Set

Hypothesis:‘s: Parameters

Size in feet2 (x) Price ($) in 1000's (y)2104 4601416 2321534 315852 178… …

Page 10: Machine Learning  Introduction
Page 11: Machine Learning  Introduction

y

x

Idea: Choose so that is close to for our training examples

Page 12: Machine Learning  Introduction

Cost Function

Hypothesis:

Parameters:

Cost Function:

Goal:

Simplified:

Page 13: Machine Learning  Introduction

Price ($) in

1000’s

Size in feet2 (x)

Question:How to minimize J?

Page 14: Machine Learning  Introduction

Gradient Descent

Have some function

Want

Outline:

• Start with some

• Keep changing to reduce

until we hopefully end up at a minimum

Page 15: Machine Learning  Introduction

Gradient descent algorithm

Correct: Simultaneous update Incorrect:

Page 16: Machine Learning  Introduction

Gradient descent algorithm

Notice : α is the learning rate.

Page 17: Machine Learning  Introduction

If α is too small, gradient descent can be slow.

If α is too large, gradient descent can overshoot the minimum. It may fail to converge, or even diverge.

Page 18: Machine Learning  Introduction

at local optima

Current value of

Unchange

Gradient descent can converge to a local minimum, even with the learning rate α fixed.

As we approach a local minimum, gradient descent will automatically take smaller steps. So, no need to decrease α over time.

Page 19: Machine Learning  Introduction

Gradient Descent for Linear Regression

Gradient descent algorithm Linear Regression Model

Page 20: Machine Learning  Introduction

Gradient descent algorithm

update and

simultaneously

Page 21: Machine Learning  Introduction

J()

Page 22: Machine Learning  Introduction

(for fixed , this is a function of x) (function of the parameters )

Page 23: Machine Learning  Introduction

(for fixed , this is a function of x) (function of the parameters )

Page 24: Machine Learning  Introduction

(for fixed , this is a function of x) (function of the parameters )

Page 25: Machine Learning  Introduction

(for fixed , this is a function of x) (function of the parameters )

Page 26: Machine Learning  Introduction

(for fixed , this is a function of x) (function of the parameters )

Page 27: Machine Learning  Introduction

(for fixed , this is a function of x) (function of the parameters )

Page 28: Machine Learning  Introduction

(for fixed , this is a function of x) (function of the parameters )

Page 29: Machine Learning  Introduction

(for fixed , this is a function of x) (function of the parameters )

Page 30: Machine Learning  Introduction

(for fixed , this is a function of x) (function of the parameters )

Page 31: Machine Learning  Introduction

Linear Regression with multiple variables

Hypothesis:

Cost function:

Parameters:

(simultaneously update for every )

RepeatGradient descent:

Page 32: Machine Learning  Introduction

(simultaneously update )

Gradient Descent

RepeatPreviously (n=1):

New algorithm :Repeat

(simultaneously update for )

Page 33: Machine Learning  Introduction

Size (feet2) Number of bedrooms

Number of floors

Age of home (years)

Price ($1000)

1 2104 5 1 45 4601 1416 3 2 40 2321 1534 3 2 30 3151 852 2 1 36 178

Size (feet2) Number of bedrooms

Number of floors

Age of home (years)

Price ($1000)

2104 5 1 45 4601416 3 2 40 2321534 3 2 30 315852 2 1 36 178

Examples:

simultaneously update

Size (feet2) Number of bedrooms

Number of floors

Age of home (years)

Price ($1000)

2104 5 1 45 4601416 3 2 40 2321534 3 2 30 315852 2 1 36 178

Page 34: Machine Learning  Introduction

Summarize• This is a briefly Introduction about Supervised Learning(Classification)in Machine Leaning.• There is still a lot of things in this subject,such as Clustering, Support Vector Machine(SVM), Dimensionality Reduction, ETC. The Core Idea of MS is very similar,hope you will be fond of the Machine Learning !

Thanks for Listening !