Download - Begin with Machine Learning
![Page 1: Begin with Machine Learning](https://reader033.vdocuments.mx/reader033/viewer/2022051318/589a60ce1a28abc3438b5d57/html5/thumbnails/1.jpg)
Machine Learning
Narong Intiruk Data Scientist, T2P Co,.Ltd.
Begin with
![Page 2: Begin with Machine Learning](https://reader033.vdocuments.mx/reader033/viewer/2022051318/589a60ce1a28abc3438b5d57/html5/thumbnails/2.jpg)
Agenda• What is Machine Learning?
• How is Machine Learning different from traditional programming?
• How does it work?
• How to use it?
• Tools
• Resources
![Page 3: Begin with Machine Learning](https://reader033.vdocuments.mx/reader033/viewer/2022051318/589a60ce1a28abc3438b5d57/html5/thumbnails/3.jpg)
What is Machine Learning?
“Field of study that gives computers the ability to learn without being explicitly programmed”
- Arthur Samuel, 1959
![Page 4: Begin with Machine Learning](https://reader033.vdocuments.mx/reader033/viewer/2022051318/589a60ce1a28abc3438b5d57/html5/thumbnails/4.jpg)
What is Machine Learning?
Learning Algorithm
"A computer program is said to learn from experience E with respect to some class of tasks T and performance measure P if its performance at
tasks in T, as measured by P, improves with experience E."
- Tom M. Mitchell
Cat / Not Cat
this is a catE
T
Cat -> Cat : 80%
P
![Page 5: Begin with Machine Learning](https://reader033.vdocuments.mx/reader033/viewer/2022051318/589a60ce1a28abc3438b5d57/html5/thumbnails/5.jpg)
How is Machine Learning different from traditional programming?
![Page 6: Begin with Machine Learning](https://reader033.vdocuments.mx/reader033/viewer/2022051318/589a60ce1a28abc3438b5d57/html5/thumbnails/6.jpg)
How is Machine Learning different from traditional programming?
if (eyes == 2) & (legs == 4) & (tail == 1)… then print “Cat”
“ Cat ”
Traditional programming
InputProgram
Computer
Output
- eyes - legs - tail - ….. - …..
![Page 7: Begin with Machine Learning](https://reader033.vdocuments.mx/reader033/viewer/2022051318/589a60ce1a28abc3438b5d57/html5/thumbnails/7.jpg)
How is Machine Learning different from traditional programming?
if (eyes == 2) & (legs == 4) & (tail == 1)… then print “Cat”
“ Cat ”
Traditional programming
InputProgram
Computer
Output
- eyes - legs - tail - ….. - …..
![Page 8: Begin with Machine Learning](https://reader033.vdocuments.mx/reader033/viewer/2022051318/589a60ce1a28abc3438b5d57/html5/thumbnails/8.jpg)
How is Machine Learning different from traditional programming?
“ Cat ”
Machine Learning
Input
Program
Computer
Output
Cat Recognition
- eyes - legs - tail - ….. - …..
![Page 9: Begin with Machine Learning](https://reader033.vdocuments.mx/reader033/viewer/2022051318/589a60ce1a28abc3438b5d57/html5/thumbnails/9.jpg)
How does it work?
Feature Extraction
Learning Algorithm Evaluation
Optimization
Data
Model
Error
Predicted Value = f(X)We need f that Predicted Value close to True Value
(X)
(f)
Learning Process
Parameters
![Page 10: Begin with Machine Learning](https://reader033.vdocuments.mx/reader033/viewer/2022051318/589a60ce1a28abc3438b5d57/html5/thumbnails/10.jpg)
f( )=“ Cat ”
f( )=“ Cat ”
What is f()?
How does it work?
![Page 11: Begin with Machine Learning](https://reader033.vdocuments.mx/reader033/viewer/2022051318/589a60ce1a28abc3438b5d57/html5/thumbnails/11.jpg)
DataNumber/Categorical
Age Height Weight Gender
19 160 55 male
25 170 55 male
30 175 60 femal
ImageText
Sound
How does it work?
![Page 12: Begin with Machine Learning](https://reader033.vdocuments.mx/reader033/viewer/2022051318/589a60ce1a28abc3438b5d57/html5/thumbnails/12.jpg)
Feature Extraction
How does it work?
What are the things that should be considered?
![Page 13: Begin with Machine Learning](https://reader033.vdocuments.mx/reader033/viewer/2022051318/589a60ce1a28abc3438b5d57/html5/thumbnails/13.jpg)
Feature Extraction
Good BMI Bad BMI
Weight (X1)
Height (X2)
Good BMI
Bad BMI
Height Weight good/bad160 55 good
170 55 bad
175 60 good
.. .. .. Features Space
How does it work?
![Page 14: Begin with Machine Learning](https://reader033.vdocuments.mx/reader033/viewer/2022051318/589a60ce1a28abc3438b5d57/html5/thumbnails/14.jpg)
Feature Extraction
How does it work?
Multiple Dimension Feature
![Page 15: Begin with Machine Learning](https://reader033.vdocuments.mx/reader033/viewer/2022051318/589a60ce1a28abc3438b5d57/html5/thumbnails/15.jpg)
Feature Extraction
How does it work?
![Page 16: Begin with Machine Learning](https://reader033.vdocuments.mx/reader033/viewer/2022051318/589a60ce1a28abc3438b5d57/html5/thumbnails/16.jpg)
Feature Extraction
How does it work?
![Page 17: Begin with Machine Learning](https://reader033.vdocuments.mx/reader033/viewer/2022051318/589a60ce1a28abc3438b5d57/html5/thumbnails/17.jpg)
Feature Extraction
Word Importance
the 0.03
property 0.32
viceroy 0.56
….. …..
How does it work?
![Page 18: Begin with Machine Learning](https://reader033.vdocuments.mx/reader033/viewer/2022051318/589a60ce1a28abc3438b5d57/html5/thumbnails/18.jpg)
Feature Extraction
Principle Component
Analysis
Dimensionality Reduction
How does it work?
![Page 19: Begin with Machine Learning](https://reader033.vdocuments.mx/reader033/viewer/2022051318/589a60ce1a28abc3438b5d57/html5/thumbnails/19.jpg)
Feature Extraction
Automatic Feature Extraction Using Deep Learning
http://magizbox.com/training/deep_learning/site/introduction/
How does it work?
Hand-Crafted Feature Extraction
![Page 20: Begin with Machine Learning](https://reader033.vdocuments.mx/reader033/viewer/2022051318/589a60ce1a28abc3438b5d57/html5/thumbnails/20.jpg)
Feature Extraction
Automatic Feature Extraction by using DNN-Deep Learning
http://magizbox.com/training/deep_learning/site/introduction/
How does it work?
Automatic Feature Extraction
![Page 21: Begin with Machine Learning](https://reader033.vdocuments.mx/reader033/viewer/2022051318/589a60ce1a28abc3438b5d57/html5/thumbnails/21.jpg)
Feature Extraction
Automatic Feature Extraction by using CNN-Deep Learning
Image
https://devblogs.nvidia.com/parallelforall/deep-learning-nutshell-core-concepts/
How does it work?
![Page 22: Begin with Machine Learning](https://reader033.vdocuments.mx/reader033/viewer/2022051318/589a60ce1a28abc3438b5d57/html5/thumbnails/22.jpg)
Feature Extraction
Automatic Feature Extraction by using RNN-Deep Learning
Text
How does it work?
![Page 23: Begin with Machine Learning](https://reader033.vdocuments.mx/reader033/viewer/2022051318/589a60ce1a28abc3438b5d57/html5/thumbnails/23.jpg)
How does it work?
Learning Algorithm
Car for achieve the goal!
Framework for learning the target function
![Page 24: Begin with Machine Learning](https://reader033.vdocuments.mx/reader033/viewer/2022051318/589a60ce1a28abc3438b5d57/html5/thumbnails/24.jpg)
How does it work?
Learning Algorithm
Type of Learning
![Page 25: Begin with Machine Learning](https://reader033.vdocuments.mx/reader033/viewer/2022051318/589a60ce1a28abc3438b5d57/html5/thumbnails/25.jpg)
How does it work?
Learning Algorithm
Supervised Learning > Classification
( , “Cat”) LearningAlgorithm
Cat Model “Cat”Is cat or not?
![Page 26: Begin with Machine Learning](https://reader033.vdocuments.mx/reader033/viewer/2022051318/589a60ce1a28abc3438b5d57/html5/thumbnails/26.jpg)
How does it work?
Learning Algorithm
Supervised Learning > Regression
( , 4.5) LearningAlgorithm
House PriceModel 4.3 M.
What is the price of this house?
![Page 27: Begin with Machine Learning](https://reader033.vdocuments.mx/reader033/viewer/2022051318/589a60ce1a28abc3438b5d57/html5/thumbnails/27.jpg)
How does it work?
Learning Algorithm
Unsupervised Learning
( ) LearningAlgorithm
House Grouping
Model
What is the group of this house? Group 1
![Page 28: Begin with Machine Learning](https://reader033.vdocuments.mx/reader033/viewer/2022051318/589a60ce1a28abc3438b5d57/html5/thumbnails/28.jpg)
How does it work?
Learning Algorithm
Unsupervised Learning
Group1
Group2
Group3
![Page 29: Begin with Machine Learning](https://reader033.vdocuments.mx/reader033/viewer/2022051318/589a60ce1a28abc3438b5d57/html5/thumbnails/29.jpg)
How does it work?
Learning Algorithm
Reinforcement Learning
( ) LearningAlgorithm
Flappy BirdModel
How should I move?“ Down ”
Reward(+,-)
![Page 30: Begin with Machine Learning](https://reader033.vdocuments.mx/reader033/viewer/2022051318/589a60ce1a28abc3438b5d57/html5/thumbnails/30.jpg)
How does it work?
Learning Algorithm
Machine Learning Algorithms
https://en.wikipedia.org/wiki/List_of_machine_learning_concepts
![Page 31: Begin with Machine Learning](https://reader033.vdocuments.mx/reader033/viewer/2022051318/589a60ce1a28abc3438b5d57/html5/thumbnails/31.jpg)
How does it work?
Learning Algorithm
Tree Based
![Page 32: Begin with Machine Learning](https://reader033.vdocuments.mx/reader033/viewer/2022051318/589a60ce1a28abc3438b5d57/html5/thumbnails/32.jpg)
How does it work?
Learning Algorithm
Tree Based : Random Forest
![Page 33: Begin with Machine Learning](https://reader033.vdocuments.mx/reader033/viewer/2022051318/589a60ce1a28abc3438b5d57/html5/thumbnails/33.jpg)
How does it work?
Learning Algorithm
Support Vector Machine
3D Features2D Features
![Page 34: Begin with Machine Learning](https://reader033.vdocuments.mx/reader033/viewer/2022051318/589a60ce1a28abc3438b5d57/html5/thumbnails/34.jpg)
How does it work?
Learning Algorithm
Neural Network
![Page 35: Begin with Machine Learning](https://reader033.vdocuments.mx/reader033/viewer/2022051318/589a60ce1a28abc3438b5d57/html5/thumbnails/35.jpg)
How does it work?
Learning Algorithm
Neural Network : Deep Learning
Deep Neural Network (DNN)
![Page 36: Begin with Machine Learning](https://reader033.vdocuments.mx/reader033/viewer/2022051318/589a60ce1a28abc3438b5d57/html5/thumbnails/36.jpg)
How does it work?
Learning Algorithm
Neural Network : Deep Learning
Convolutional Neural Network (CNN)
![Page 37: Begin with Machine Learning](https://reader033.vdocuments.mx/reader033/viewer/2022051318/589a60ce1a28abc3438b5d57/html5/thumbnails/37.jpg)
How does it work?
Learning Algorithm
Neural Network : Deep Learning
Recurrent Neural Network(RNN)
![Page 38: Begin with Machine Learning](https://reader033.vdocuments.mx/reader033/viewer/2022051318/589a60ce1a28abc3438b5d57/html5/thumbnails/38.jpg)
How does it work?
Evaluation
Learning Algorithm
Cat / Not Cat Model
this is a cat
Cat -> Cat : 200Cat -> Not Cat : 10
How many is loss?
![Page 39: Begin with Machine Learning](https://reader033.vdocuments.mx/reader033/viewer/2022051318/589a60ce1a28abc3438b5d57/html5/thumbnails/39.jpg)
How does it work?Optimization
Tuning the car’s engine
![Page 40: Begin with Machine Learning](https://reader033.vdocuments.mx/reader033/viewer/2022051318/589a60ce1a28abc3438b5d57/html5/thumbnails/40.jpg)
How does it work?Optimization
Parameters Space (W1,W2)
f(X) = X1W1 + X2W2 +b
J is the cost function of Learning Algorithm
![Page 41: Begin with Machine Learning](https://reader033.vdocuments.mx/reader033/viewer/2022051318/589a60ce1a28abc3438b5d57/html5/thumbnails/41.jpg)
How does it work?Optimization
http://playground.tensorflow.org/
Find the best parameters for the functionbad fair good very good
![Page 42: Begin with Machine Learning](https://reader033.vdocuments.mx/reader033/viewer/2022051318/589a60ce1a28abc3438b5d57/html5/thumbnails/42.jpg)
How to use it?
test
trainX
Y
![Page 43: Begin with Machine Learning](https://reader033.vdocuments.mx/reader033/viewer/2022051318/589a60ce1a28abc3438b5d57/html5/thumbnails/43.jpg)
How to use it?
Feature matrix and Label vector
1 0.2 0.32 -0.93 0.32
2 -0.17 0.32 0.52 -0.93
3 -0.93 -0.17 0.52 -0.17
4 0.32 0.52 -0.17 -0.93
1
0
0
1
XY
}
Input Output
![Page 44: Begin with Machine Learning](https://reader033.vdocuments.mx/reader033/viewer/2022051318/589a60ce1a28abc3438b5d57/html5/thumbnails/44.jpg)
How to use it?
Feature Extraction : Number/Categorical
no x1 x2 x3 x4
1 0.2 0.32 -0.93 0.32
2 -0.17 0.32 0.52 -0.93
3 -0.93 -0.17 0.52 -0.17
X
}Age Height Weigh
tGender Abnormal
19 160 55 male No
25 170 55 male No
30 120 60 femal Yes
0
0
1
Y
Normal(0)/ Abnormal(1)
Covert categorical to number and normalize data
![Page 45: Begin with Machine Learning](https://reader033.vdocuments.mx/reader033/viewer/2022051318/589a60ce1a28abc3438b5d57/html5/thumbnails/45.jpg)
How to use it?
Feature Extraction : Text -> Binary Vectors
doc1 : You are so cool doc2 : You are very bad doc3 : You are very good
word indexyou 0are 1so 2
cool 3very 4bad 5good 6
corpus dictionary
doc1 : 0 1 2 3 doc2 : 0 1 4 5 doc3 : 0 1 4 6Feature index
no x0 x1 x2 x3 x4 x5 x61 1 1 1 1 0 0 02 1 1 0 0 1 1 03 1 1 0 0 1 0 1Binary Feature Vectors
![Page 46: Begin with Machine Learning](https://reader033.vdocuments.mx/reader033/viewer/2022051318/589a60ce1a28abc3438b5d57/html5/thumbnails/46.jpg)
How to use it?Feature Extraction : Text -> TF-IDF Vectors
doc1 : You are so cool doc2 : You are very bad doc3 : You are very good
word indexyou 0are 1so 2
cool 3very 4bad 5good 6
corpus dictionary
doc1 : 0 1 2 3 doc2 : 0 1 4 5 doc3 : 0 1 4 6Feature index
no x0 x1 x2 x3 x4 x5 x61 0.1 0.1 0.3 0.3 0 0 02 0.1 0.1 0 0 0.2 0.3 03 0.1 0.1 0 0 0.2 0 0.3TF-IDF Feature Vectors
word indexyou 0.1are 0.1so 0.3
cool 0.3very 0.2bad 0.3good 0.3
corpus TF-IDF
https://en.wikipedia.org/wiki/Tf%E2%80%93idf
![Page 47: Begin with Machine Learning](https://reader033.vdocuments.mx/reader033/viewer/2022051318/589a60ce1a28abc3438b5d57/html5/thumbnails/47.jpg)
How to use it?Feature Extraction : Text -> Word2Vec
word2Vec model
![Page 48: Begin with Machine Learning](https://reader033.vdocuments.mx/reader033/viewer/2022051318/589a60ce1a28abc3438b5d57/html5/thumbnails/48.jpg)
How to use it?Feature Extraction : Text -> Word2Vec -> Visualize
![Page 49: Begin with Machine Learning](https://reader033.vdocuments.mx/reader033/viewer/2022051318/589a60ce1a28abc3438b5d57/html5/thumbnails/49.jpg)
How to use it?Feature Extraction : Image -> Pixel Vector
gray scale image (MxN) normalized image matrix (MxN)
[0,0,0,..,0.6,0.5,0,0,0,0,0,0,0,0,0……..0]
pixel1 pixelMxN
Pixel Vector
![Page 50: Begin with Machine Learning](https://reader033.vdocuments.mx/reader033/viewer/2022051318/589a60ce1a28abc3438b5d57/html5/thumbnails/50.jpg)
How to use it?Feature Extraction : Image -> Pixel Vector
[0,0,0,..,0.6,0.5,0,0,0,0,0,0,0,0,0……..0]image1
Deep Neural Network
![Page 51: Begin with Machine Learning](https://reader033.vdocuments.mx/reader033/viewer/2022051318/589a60ce1a28abc3438b5d57/html5/thumbnails/51.jpg)
How to use it?Feature Extraction : Image -> raw / gray scale image
raw image
12345
Convolutional Neural Network
http://cs.stanford.edu/people/karpathy/convnetjs/
![Page 52: Begin with Machine Learning](https://reader033.vdocuments.mx/reader033/viewer/2022051318/589a60ce1a28abc3438b5d57/html5/thumbnails/52.jpg)
How to use it?
Model Evaluation
Confusion Matrix
![Page 53: Begin with Machine Learning](https://reader033.vdocuments.mx/reader033/viewer/2022051318/589a60ce1a28abc3438b5d57/html5/thumbnails/53.jpg)
How to use it?
Model Evaluation
Confusion Matrix Example
Normal Abnormal
Predict Normal 90 10
Predict Abnormal 10 90
Precision = 90/(90 + 10) = 0.9Recall = 90/(90 + 10) = 0.9
Acc = (90+90)/(90+10+90+10) = 0.9
![Page 54: Begin with Machine Learning](https://reader033.vdocuments.mx/reader033/viewer/2022051318/589a60ce1a28abc3438b5d57/html5/thumbnails/54.jpg)
How to use it?
Model Evaluation : Underfitting and Overfitting
Good on training set but bad on test set
Bad on training set and test set
Good on training set and test set
![Page 55: Begin with Machine Learning](https://reader033.vdocuments.mx/reader033/viewer/2022051318/589a60ce1a28abc3438b5d57/html5/thumbnails/55.jpg)
How to use it?
cluster number
Unsupervised Learning Workflow
![Page 56: Begin with Machine Learning](https://reader033.vdocuments.mx/reader033/viewer/2022051318/589a60ce1a28abc3438b5d57/html5/thumbnails/56.jpg)
How to use it?
Evaluation
Sum of squared erros
![Page 57: Begin with Machine Learning](https://reader033.vdocuments.mx/reader033/viewer/2022051318/589a60ce1a28abc3438b5d57/html5/thumbnails/57.jpg)
ToolsData Preparation
Machine Learning
Deep Learning
Keras
Data Visualization
scikit-learn
![Page 58: Begin with Machine Learning](https://reader033.vdocuments.mx/reader033/viewer/2022051318/589a60ce1a28abc3438b5d57/html5/thumbnails/58.jpg)
Resources
http://scikit-learn.org/stable/
https://keras.io/
https://www.tensorflow.org/
http://cs.stanford.edu/people/karpathy/convnetjs/
https://www.coursera.org/learn/machine-learning
[DeepLearning.TV] https://www.youtube.com/channel/UC9OeZkIwhzfv-_Cb7fCikLQ
http://machinelearningmastery.com/introduction-python-deep-learning-library-keras/
[Deep Learning Summer School 2016] https://www.youtube.com/playlist?list=PLWtzrfzH7gsfxTs8neTRJDXuqAn7qeV4E
http://courses.washington.edu/css490/2012.Winter/lecture_slides/02_math_essentials.pdf
[Deep learning at Oxford 2015] https://www.youtube.com/playlist?list=PLE6Wd9FR--EfW8dtjAuPoTuPcqmOV53Fu