SlideShare a Scribd company logo
1 of 22
Download to read offline
機器學習基礎簡介	
  
Mark	
  Chang	
  
什麼是學習?	
  
•  從已知的資料,根據資料的特徵,歸納出
其中的規則(知識)。	
  
•  用這個規則(知識)可預測未知的資料。	
  
什麼是機器學習?	
  
•  讓機器(電腦)根據已知資料的特徵,歸
納出其中的規則。	
  
•  用這個規則可預測未知的資料。	
  
•  機器學習可分為兩大類:	
  
– 監督式學習:有老師,告訴答案	
  
– 非監督式學習:沒老師,自己學	
  
監督式學習種類	
  
•  分類(Classifica/on):答案為一個類別	
  
•  迴歸(Regression):答案為一個數值	
  
機器學習模型
•  迴歸:	
  
– 線性回歸(Linear	
  Regression)	
  
•  分類:	
  
– 邏輯迴歸(Logis/c	
  Regression)	
  
符號慣例
訓練資料	
  
全部:X	
  ,	
  Y	
  
單筆:x(i),	
  y(i)	
  
機器學習模型	
  
h	
  
模型參數	
  
w
輸出值	
  
h(X)
正確答案	
  
Y
對答案	
  
E(h(X),Y)
如果答錯了,
要修正模型
X
Y
線性回歸(Linear	
  Regression)
•  用直線去逼近資料分佈情形	
  
訓練資料
X	
   Y	
  
-­‐1	
   -­‐1.35083488	
  
-­‐0.93103448	
   -­‐0.832318	
  
-­‐0.86206897	
   -­‐1.80594819	
  
-­‐0.79310345	
   -­‐0.41854779	
  
-­‐0.72413793	
   -­‐1.49916917	
  
-­‐0.65517241	
   -­‐0.33899642	
  
-­‐0.5862069	
   -­‐0.25423128	
  
-­‐0.51724138	
   -­‐2.11349879	
  
-­‐0.44827586	
   0.59621997	
  
-­‐0.37931034	
   0.18047539	
  
-­‐0.31034483	
   0.37495828	
  
…	
   …	
  
	
  	
  x	
  	
  	
  	
  	
  	
  	
  
	
  	
  y	
  	
  	
  	
  	
  	
  	
  
機器學習模型	
  
w0=1,	
  w1=-­‐1	
  
h(x) = w0 + w1x
修正模型
•  Error	
  func/on:	
  
	
  
E(h(X), Y )
=
1
2m
mX
i=1
(h(x(i)
) y(i)
)2
=
1
2m
mX
i=1
((w0 + w1x(i)
) y(i)
)2
y(i)
h(x(i)
)
(h(x(i)
) y(i)
)2
修正模型
•  Error	
  func/on:	
  
	
  
w0=1,	
  w1=-­‐1	
  
	
  	
  w1	
  	
  	
  
	
  	
  w0	
  	
  	
  	
  
	
  	
  E(h(X),Y)	
  
E(h(X), Y )
=
1
2m
mX
i=1
(h(x(i)
) y(i)
)2
=
1
2m
mX
i=1
((w0 + w1x(i)
) y(i)
)2
 	
  w1	
  	
  	
  
	
  	
  w0	
  	
  	
  	
  
	
  	
  E(h(X),Y)	
  
修正模型
•  梯度下降(Gradient	
  Descent):	
  
(
@E(h(X), Y )
@w0
,
@E(h(X), Y )
@w1
)
	
  η	
  :	
  Learning	
  Rate	
  
w0 w0–⌘
@E(h(X), Y )
@w0
w1 w1–⌘
@E(h(X), Y )
@w1
修正模型
邏輯回歸(Logis/c	
  Regression)	
  
•  用Sigmoid曲線去逼近資料的分佈情形	
  
訓練資料	
  
X	
   Y	
  
-­‐0.47241379	 0
-­‐0.35344828	 0
-­‐0.30148276	 0
0.33448276	 1
0.35344828	 1
0.37241379	 1
0.39137931	 1
0.41034483	 1
0.44931034	 1
0.49827586	 1
0.51724138	 1
….	 ….
機器學習模型	
  
Sigmoid	
  func/on	
   h(x) =
1
1 + e (w0+w1x)
w0 + w1x < 0
h(x) ⇡ 0
w0 + w1x > 0
h(x) ⇡ 1
修正模型	
  
•  Error	
  func/on	
  :	
  Cross	
  Entropy	
  
	
  E(h(X), Y ) =
1
m
(
mX
i
y(i)
log(h(x(i)
)) + (1 y(i)
)log(1 h(x(i)
)))
y(i)
= 1
E(h(x(i)
), y(i)
) = log(h(x(i)
))
h(x(i)
) ⇡ 0 ) E(h(x(i)
), y(i)
) ⇡ 1
h(x(i)
) ⇡ 1 ) E(h(x(i)
), y(i)
) ⇡ 0
y(i)
= 0
E(h(x(i)
), y(i)
) = log(1 h(x(i)
))
h(x(i)
) ⇡ 0 ) E(h(x(i)
), y(i)
) ⇡ 0
h(x(i)
) ⇡ 1 ) E(h(x(i)
), y(i)
) ⇡ 1
修正模型	
  
•  Error	
  func/on	
  :	
  Cross	
  Entropy	
  
	
  E(h(X), Y ) =
1
m
(
mX
i
y(i)
log(h(x(i)
)) + (1 y(i)
)log(1 h(x(i)
)))
h(x(i)
) ⇡ 0 and y(i)
= 0 ) E(h(X), Y ) ⇡ 0
h(x(i)
) ⇡ 1 and y(i)
= 1 ) E(h(X), Y ) ⇡ 0
h(x(i)
) ⇡ 0 and y(i)
= 1 ) E(h(X), Y ) ⇡ 1
h(x(i)
) ⇡ 1 and y(i)
= 0 ) E(h(X), Y ) ⇡ 1
 	
  w1	
  	
  	
  
	
  	
  w0	
  	
  	
  	
  
修正模型	
  
•  梯度下降:	
  
	
  
w0 w0–⌘
@E(h(X), Y )
@w0
w1 w1–⌘
@E(h(X), Y )
@w1
(
@E(h(X), Y )
@w0
,
@E(h(X), Y )
@w1
)
修正模型	
  
實作:邏輯回歸	
  
延伸閱讀	
  
•  Logis/c	
  Regression	
  3D	
  
–  hVp://cpmarkchang.logdown.com/posts/189069-­‐logis/-­‐regression-­‐model	
  
•  OverFi[ng	
  and	
  Regulariza/on	
  
–  hVp://cpmarkchang.logdown.com/posts/193261-­‐machine-­‐learning-­‐overfi[ng-­‐and-­‐regulariza/on	
  
•  Model	
  Selec/on	
  
–  hVp://cpmarkchang.logdown.com/posts/193914-­‐machine-­‐learning-­‐model-­‐selec/on	
  
•  Neural	
  Network	
  Back	
  Propaga/on	
  
–  hVp://cpmarkchang.logdown.com/posts/277349-­‐neural-­‐network-­‐backward-­‐propaga/on	
  

More Related Content

What's hot

Python - Matplotlib basic - v01
Python - Matplotlib basic - v01Python - Matplotlib basic - v01
Python - Matplotlib basic - v01ssuser5e7722
 
[系列活動] 手把手打開Python資料分析大門
[系列活動] 手把手打開Python資料分析大門[系列活動] 手把手打開Python資料分析大門
[系列活動] 手把手打開Python資料分析大門台灣資料科學年會
 
Solitaire with Greenfoot #2
Solitaire with Greenfoot #2Solitaire with Greenfoot #2
Solitaire with Greenfoot #2imacat .
 
Hands on data analysis 101
Hands on data analysis 101Hands on data analysis 101
Hands on data analysis 101FEG
 
20161209-Julia Taiwan first meetup-julia語言入門
20161209-Julia Taiwan first meetup-julia語言入門20161209-Julia Taiwan first meetup-julia語言入門
20161209-Julia Taiwan first meetup-julia語言入門岳華 杜
 
Hands-on tutorial of deep learning (Keras)
Hands-on tutorial of deep learning (Keras)Hands-on tutorial of deep learning (Keras)
Hands-on tutorial of deep learning (Keras)Chun-Min Chang
 
Num py basic(2) - v01
Num py   basic(2) - v01Num py   basic(2) - v01
Num py basic(2) - v01ssuser5e7722
 
資料結構-20個經典題型
資料結構-20個經典題型資料結構-20個經典題型
資料結構-20個經典題型逸 張
 

What's hot (17)

Python - Matplotlib basic - v01
Python - Matplotlib basic - v01Python - Matplotlib basic - v01
Python - Matplotlib basic - v01
 
[系列活動] 手把手打開Python資料分析大門
[系列活動] 手把手打開Python資料分析大門[系列活動] 手把手打開Python資料分析大門
[系列活動] 手把手打開Python資料分析大門
 
Ppt 136-136
Ppt 136-136Ppt 136-136
Ppt 136-136
 
Ppt 26-50
Ppt 26-50Ppt 26-50
Ppt 26-50
 
Solitaire with Greenfoot #2
Solitaire with Greenfoot #2Solitaire with Greenfoot #2
Solitaire with Greenfoot #2
 
Hands on data analysis 101
Hands on data analysis 101Hands on data analysis 101
Hands on data analysis 101
 
20161209-Julia Taiwan first meetup-julia語言入門
20161209-Julia Taiwan first meetup-julia語言入門20161209-Julia Taiwan first meetup-julia語言入門
20161209-Julia Taiwan first meetup-julia語言入門
 
R intro 20140716-basic
R intro 20140716-basicR intro 20140716-basic
R intro 20140716-basic
 
Hands-on tutorial of deep learning (Keras)
Hands-on tutorial of deep learning (Keras)Hands-on tutorial of deep learning (Keras)
Hands-on tutorial of deep learning (Keras)
 
Num py basic(2) - v01
Num py   basic(2) - v01Num py   basic(2) - v01
Num py basic(2) - v01
 
資料結構-20個經典題型
資料結構-20個經典題型資料結構-20個經典題型
資料結構-20個經典題型
 
Ch12
Ch12Ch12
Ch12
 
Ch2 教學
Ch2 教學Ch2 教學
Ch2 教學
 
Ppt 1-50
Ppt 1-50Ppt 1-50
Ppt 1-50
 
P127 135 new
P127 135 newP127 135 new
P127 135 new
 
Ch5 範例
Ch5 範例Ch5 範例
Ch5 範例
 
Sym py edu
Sym py eduSym py edu
Sym py edu
 

Similar to Machine Learning Introduction

机器学习与深度学习简介.pdf
机器学习与深度学习简介.pdf机器学习与深度学习简介.pdf
机器学习与深度学习简介.pdfCyanny LIANG
 
TENSORFLOW深度學習講座講義(很硬的課程) 4/14
TENSORFLOW深度學習講座講義(很硬的課程) 4/14TENSORFLOW深度學習講座講義(很硬的課程) 4/14
TENSORFLOW深度學習講座講義(很硬的課程) 4/14NTC.im(Notch Training Center)
 
R 語言教學: 探索性資料分析與文字探勘初探
R 語言教學: 探索性資料分析與文字探勘初探R 語言教學: 探索性資料分析與文字探勘初探
R 語言教學: 探索性資料分析與文字探勘初探Sean Yu
 
建造与理解-用Python实现深度学习框架
建造与理解-用Python实现深度学习框架建造与理解-用Python实现深度学习框架
建造与理解-用Python实现深度学习框架ZhenChen57
 
Behavior+tree+ai lite
Behavior+tree+ai liteBehavior+tree+ai lite
Behavior+tree+ai lite勇浩 赖
 
机器学习
机器学习机器学习
机器学习seyo816
 
Clojure
ClojureClojure
ClojureDi Xu
 
机器学习概述
机器学习概述机器学习概述
机器学习概述Dong Guo
 
数据结构(用面向对象方法与C++语言描述第二版)殷人昆编著清华大学出版社
数据结构(用面向对象方法与C++语言描述第二版)殷人昆编著清华大学出版社数据结构(用面向对象方法与C++语言描述第二版)殷人昆编著清华大学出版社
数据结构(用面向对象方法与C++语言描述第二版)殷人昆编著清华大学出版社pingjiang
 
手勢以及身體骨架辨識
手勢以及身體骨架辨識手勢以及身體骨架辨識
手勢以及身體骨架辨識CHENHuiMei
 
文本序列标注模型:从Crf到rnn
文本序列标注模型:从Crf到rnn文本序列标注模型:从Crf到rnn
文本序列标注模型:从Crf到rnnYunchao He
 
手把手打開Python資料分析大門
手把手打開Python資料分析大門手把手打開Python資料分析大門
手把手打開Python資料分析大門Yen-lung Tsai
 

Similar to Machine Learning Introduction (15)

机器学习与深度学习简介.pdf
机器学习与深度学习简介.pdf机器学习与深度学习简介.pdf
机器学习与深度学习简介.pdf
 
TENSORFLOW深度學習講座講義(很硬的課程) 4/14
TENSORFLOW深度學習講座講義(很硬的課程) 4/14TENSORFLOW深度學習講座講義(很硬的課程) 4/14
TENSORFLOW深度學習講座講義(很硬的課程) 4/14
 
20200323 - AI Intro
20200323 - AI Intro20200323 - AI Intro
20200323 - AI Intro
 
LabView with Lego NXT
LabView  with Lego NXTLabView  with Lego NXT
LabView with Lego NXT
 
R 語言教學: 探索性資料分析與文字探勘初探
R 語言教學: 探索性資料分析與文字探勘初探R 語言教學: 探索性資料分析與文字探勘初探
R 語言教學: 探索性資料分析與文字探勘初探
 
建造与理解-用Python实现深度学习框架
建造与理解-用Python实现深度学习框架建造与理解-用Python实现深度学习框架
建造与理解-用Python实现深度学习框架
 
Behavior+tree+ai lite
Behavior+tree+ai liteBehavior+tree+ai lite
Behavior+tree+ai lite
 
机器学习
机器学习机器学习
机器学习
 
Clojure
ClojureClojure
Clojure
 
机器学习概述
机器学习概述机器学习概述
机器学习概述
 
数据结构(用面向对象方法与C++语言描述第二版)殷人昆编著清华大学出版社
数据结构(用面向对象方法与C++语言描述第二版)殷人昆编著清华大学出版社数据结构(用面向对象方法与C++语言描述第二版)殷人昆编著清华大学出版社
数据结构(用面向对象方法与C++语言描述第二版)殷人昆编著清华大学出版社
 
手勢以及身體骨架辨識
手勢以及身體骨架辨識手勢以及身體骨架辨識
手勢以及身體骨架辨識
 
Essential C/C++
Essential C/C++Essential C/C++
Essential C/C++
 
文本序列标注模型:从Crf到rnn
文本序列标注模型:从Crf到rnn文本序列标注模型:从Crf到rnn
文本序列标注模型:从Crf到rnn
 
手把手打開Python資料分析大門
手把手打開Python資料分析大門手把手打開Python資料分析大門
手把手打開Python資料分析大門
 

More from Mark Chang

Modeling the Dynamics of SGD by Stochastic Differential Equation
Modeling the Dynamics of SGD by Stochastic Differential EquationModeling the Dynamics of SGD by Stochastic Differential Equation
Modeling the Dynamics of SGD by Stochastic Differential EquationMark Chang
 
Modeling the Dynamics of SGD by Stochastic Differential Equation
Modeling the Dynamics of SGD by Stochastic Differential EquationModeling the Dynamics of SGD by Stochastic Differential Equation
Modeling the Dynamics of SGD by Stochastic Differential EquationMark Chang
 
Information in the Weights
Information in the WeightsInformation in the Weights
Information in the WeightsMark Chang
 
Information in the Weights
Information in the WeightsInformation in the Weights
Information in the WeightsMark Chang
 
PAC Bayesian for Deep Learning
PAC Bayesian for Deep LearningPAC Bayesian for Deep Learning
PAC Bayesian for Deep LearningMark Chang
 
PAC-Bayesian Bound for Deep Learning
PAC-Bayesian Bound for Deep LearningPAC-Bayesian Bound for Deep Learning
PAC-Bayesian Bound for Deep LearningMark Chang
 
Domain Adaptation
Domain AdaptationDomain Adaptation
Domain AdaptationMark Chang
 
NTU ML TENSORFLOW
NTU ML TENSORFLOWNTU ML TENSORFLOW
NTU ML TENSORFLOWMark Chang
 
NTHU AI Reading Group: Improved Training of Wasserstein GANs
NTHU AI Reading Group: Improved Training of Wasserstein GANsNTHU AI Reading Group: Improved Training of Wasserstein GANs
NTHU AI Reading Group: Improved Training of Wasserstein GANsMark Chang
 
Generative Adversarial Networks
Generative Adversarial NetworksGenerative Adversarial Networks
Generative Adversarial NetworksMark Chang
 
Applied Deep Learning 11/03 Convolutional Neural Networks
Applied Deep Learning 11/03 Convolutional Neural NetworksApplied Deep Learning 11/03 Convolutional Neural Networks
Applied Deep Learning 11/03 Convolutional Neural NetworksMark Chang
 
The Genome Assembly Problem
The Genome Assembly ProblemThe Genome Assembly Problem
The Genome Assembly ProblemMark Chang
 
DRAW: Deep Recurrent Attentive Writer
DRAW: Deep Recurrent Attentive WriterDRAW: Deep Recurrent Attentive Writer
DRAW: Deep Recurrent Attentive WriterMark Chang
 
淺談深度學習
淺談深度學習淺談深度學習
淺談深度學習Mark Chang
 
Variational Autoencoder
Variational AutoencoderVariational Autoencoder
Variational AutoencoderMark Chang
 
TensorFlow 深度學習快速上手班--電腦視覺應用
TensorFlow 深度學習快速上手班--電腦視覺應用TensorFlow 深度學習快速上手班--電腦視覺應用
TensorFlow 深度學習快速上手班--電腦視覺應用Mark Chang
 
TensorFlow 深度學習快速上手班--自然語言處理應用
TensorFlow 深度學習快速上手班--自然語言處理應用TensorFlow 深度學習快速上手班--自然語言處理應用
TensorFlow 深度學習快速上手班--自然語言處理應用Mark Chang
 
TensorFlow 深度學習快速上手班--機器學習
TensorFlow 深度學習快速上手班--機器學習TensorFlow 深度學習快速上手班--機器學習
TensorFlow 深度學習快速上手班--機器學習Mark Chang
 
Computational Linguistics week 10
 Computational Linguistics week 10 Computational Linguistics week 10
Computational Linguistics week 10Mark Chang
 

More from Mark Chang (20)

Modeling the Dynamics of SGD by Stochastic Differential Equation
Modeling the Dynamics of SGD by Stochastic Differential EquationModeling the Dynamics of SGD by Stochastic Differential Equation
Modeling the Dynamics of SGD by Stochastic Differential Equation
 
Modeling the Dynamics of SGD by Stochastic Differential Equation
Modeling the Dynamics of SGD by Stochastic Differential EquationModeling the Dynamics of SGD by Stochastic Differential Equation
Modeling the Dynamics of SGD by Stochastic Differential Equation
 
Information in the Weights
Information in the WeightsInformation in the Weights
Information in the Weights
 
Information in the Weights
Information in the WeightsInformation in the Weights
Information in the Weights
 
PAC Bayesian for Deep Learning
PAC Bayesian for Deep LearningPAC Bayesian for Deep Learning
PAC Bayesian for Deep Learning
 
PAC-Bayesian Bound for Deep Learning
PAC-Bayesian Bound for Deep LearningPAC-Bayesian Bound for Deep Learning
PAC-Bayesian Bound for Deep Learning
 
Domain Adaptation
Domain AdaptationDomain Adaptation
Domain Adaptation
 
NTU ML TENSORFLOW
NTU ML TENSORFLOWNTU ML TENSORFLOW
NTU ML TENSORFLOW
 
NTHU AI Reading Group: Improved Training of Wasserstein GANs
NTHU AI Reading Group: Improved Training of Wasserstein GANsNTHU AI Reading Group: Improved Training of Wasserstein GANs
NTHU AI Reading Group: Improved Training of Wasserstein GANs
 
Generative Adversarial Networks
Generative Adversarial NetworksGenerative Adversarial Networks
Generative Adversarial Networks
 
Applied Deep Learning 11/03 Convolutional Neural Networks
Applied Deep Learning 11/03 Convolutional Neural NetworksApplied Deep Learning 11/03 Convolutional Neural Networks
Applied Deep Learning 11/03 Convolutional Neural Networks
 
The Genome Assembly Problem
The Genome Assembly ProblemThe Genome Assembly Problem
The Genome Assembly Problem
 
DRAW: Deep Recurrent Attentive Writer
DRAW: Deep Recurrent Attentive WriterDRAW: Deep Recurrent Attentive Writer
DRAW: Deep Recurrent Attentive Writer
 
淺談深度學習
淺談深度學習淺談深度學習
淺談深度學習
 
Variational Autoencoder
Variational AutoencoderVariational Autoencoder
Variational Autoencoder
 
TensorFlow 深度學習快速上手班--電腦視覺應用
TensorFlow 深度學習快速上手班--電腦視覺應用TensorFlow 深度學習快速上手班--電腦視覺應用
TensorFlow 深度學習快速上手班--電腦視覺應用
 
TensorFlow 深度學習快速上手班--自然語言處理應用
TensorFlow 深度學習快速上手班--自然語言處理應用TensorFlow 深度學習快速上手班--自然語言處理應用
TensorFlow 深度學習快速上手班--自然語言處理應用
 
TensorFlow 深度學習快速上手班--機器學習
TensorFlow 深度學習快速上手班--機器學習TensorFlow 深度學習快速上手班--機器學習
TensorFlow 深度學習快速上手班--機器學習
 
Computational Linguistics week 10
 Computational Linguistics week 10 Computational Linguistics week 10
Computational Linguistics week 10
 
Neural Doodle
Neural DoodleNeural Doodle
Neural Doodle
 

Machine Learning Introduction