SlideShare a Scribd company logo
Digit Recognizer
홍철주
발표자 소개
홍철주
• http://blog.fegs.kr
• https://github.com/FeGs
• Machine Learning Newbie
• SW Maestro 5th
2
목차
• 문제 소개
• k-NN, …
• Dimensionality Reduction
• 다시 k-NN, …
• Neural Networks
3
문제 소개
데이터 : 손으로 쓴 숫자 이미지 (28px * 28px, grayscale)
목적 변수 : 숫자 (0, 1, 2, …, 9)
0 1 2 3 4 5
4
손으로 적은 숫자들을 분류하기
학습 데이터 : 42000개 테스트 데이터 : 28000개
Example: MNIST (kaggle)
[…, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
23, 210, 254, 253, 159, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, …]
784차원 공간을 생각해보자 :
Method 1: k-NN
Method 2: SVM
Method 3: Random Forest, etc..
784차원 공간에서 가까이 있는 좌표의 label은?
784차원 공간을 783차원 초평면으로 갈라서 분류해보면?
이 위치에 하얀 픽셀이 있고 저기엔 없으면?
어떤 방법이 가장 좋은가?
5
기억나시는지?
Feature?
[…, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
23, 210, 254, 253, 159, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, …]
이미지의 픽셀값을 feature로 이용
feature0 feature1 feature2 … feature783
k-NN 784차원 공간에서 가까이 있는 좌표의 label은?
sklearn.neighbors.KNeighborsClassifier(n_neighbors=10, weights='distance',
algorithm='auto', leaf_size=30, p=2, metric='minkowski', metric_params=None)
Accuracy = 96.65% 10-fold CV
RF 이 위치에 하얀 픽셀이 있고 저기엔 없으면? (784개의 feature)
Accuracy = 90.28%
sklearn.ensemble.RandomForestClassifier(n_estimators=100, criterion='gini',
max_depth=None, min_samples_split=2, min_samples_leaf=1, max_features='auto',
max_leaf_nodes=None, bootstrap=True, oob_score=False, n_jobs=1, random_state=None,
verbose=0, min_density=None, compute_importances=None)
10-fold CV
시간이 오래 걸림.
정확도도 가져가고
시간도 단축하고 싶은데
PCA Principal component analysis
다시 설명하면
v v = a1e1 + a2e2 + … + anen (n = dim(v))
v 는 t = [a1, a2, …, an]로 표현 가능, ||t|| = n
근데 e1, e2, …, en 대신 w1, w2, …, wm을 쓰면
v ~= b1w1 + b2w2 + … + bmwm 처럼 되더라
v 는 u = [b1, b2, …, bm]으로도 표현 가능, ||u|| = m
PCA Principal component analysis
w1, w2, …, wm 의 정의는?
http://www.stat.cmu.edu/~cshalizi/350/lectures/10/lecture-10.pdf실제로 구하는 방법은 ->
PCA + k-NN
10차원으로 낮췄을 때 : 92.6%
33차원으로 낮췄을 때 : 97.3%
5 3 8 9
56차원으로 낮췄을 때 : 97.2%
차원을 낮추고 학습시키면?
sklearn.neighbors.KNeighborsClassifier(n_neighbors=10, weights='distance',
algorithm='auto', leaf_size=30, p=2, metric='minkowski', metric_params=None)
10-fold CV
PCA + RF
10차원으로 낮췄을 때 : 89.9%
33차원으로 낮췄을 때 : 95.2%
5 3 8 9
56차원으로 낮췄을 때 : 95.1%
차원을 낮추고 학습시키면?
10-fold CV
sklearn.ensemble.RandomForestClassifier(n_estimators=200, criterion='gini',
max_depth=None, min_samples_split=2, min_samples_leaf=1, max_features='auto',
max_leaf_nodes=None, bootstrap=True, oob_score=False, n_jobs=1, random_state=None,
verbose=0, min_density=None, compute_importances=None)
Deep Learning
• 간단한 역사를 설명하면
• 인공신경망 연구는 오류 역전파 알고리즘으로 …
• 하지만 학습에 시간이 오래 걸리고, Overfitting, …
• 그러다가 하드웨어도 좋아지고 이걸 빅데이터가?
• Local minima 이슈는 High-dimension non-convex
optimization에서는 별로..
• RBM, DBN에 대한 이야기는 넘어가고 NN 이야기만..
http://www.slideshare.net/secondmath/deep-learning-by-jskim
ANN Artificial Neural Network
ANN Artificial Neural Network
ANN Artificial Neural Network
ANN Artificial Neural Network
Logistic function
Logistic function의 일반화
Softmax function
Sigmoid function
Logistic Regression
Gradient Descent 지역 최적점을 찾아서
BP Algorithm Weight, bias의 보정
MLP Multi Layer Perceptron
Hidden Layer 가 여러 층
MLP Multi Layer Perceptron
input0
input1
output0
output1
hidden0
hidden1
hidden2
x
Layer0 Layer1 Layer2
W
b0
z = Wx + b
tanh
y = tanh(z)
MLP Multi Layer Perceptron
input0
input1
output0
output1
hidden0
hidden1
hidden2
x
Layer0 Layer1 Layer2
W
b0
z = Wx + b
tanh
y = tanh(z)
Hidden Layer
MLP Multi Layer Perceptron
output0
output1
hidden0
hidden1
hidden2
Layer1 Layer2
W
b0
z = Wx + b
tanh
y = tanh(z)
softmax
y_pred
argmax
z = Wx + b
b1
z = Wx + b
b1
MLP Multi Layer Perceptron
output0
output1
hidden0
hidden1
hidden2
Layer1 Layer2
W
b0
z = Wx + b
tanh
y = tanh(z)
softmax
y_pred
argmax
Logistic Regression
CNN Convolutional Neural Network
Convolution Feature map?
Image Convolution
Max-pooling
Downsampling
CNN Convolutional Neural Network
Convolution Layer MLP
Dropout/connect Avoid overfitting
input0
input1
output0
output1
hidden0
hidden1
hidden2
Layer0 Layer1 Layer2
b0
dropconnect
dropout
CNN 여기까지 오느라 수고하셨습니다-
Convolutional neural networks 1. convolution layer (feature map = 4, 5*5) 2. max
pooling layer (2*2) 3. convolution layer (feature map = 10, 5*5) 4. max pooling
layer (2*2) 5. hidden layer (500 neurons, tanh activation) 6. output layer (500 ->
10, logistic regression)
Accuracy = 96.74% 10-fold CV
발표자료 만들고보니 feature 맵을 잘못 넣었다는 것을 깨달음
제대로 했으면 sample 수는 적지만 98+%도 가능한지는 다음에
것보다 kaggle에서 원래 데이터를 다 안 줌 =_=
EOF

More Related Content

PPTX
해커에게 전해들은 머신러닝 #4
PPTX
해커에게 전해들은 머신러닝 #1
PPTX
Learning to remember rare events
PPTX
MNIST for ML beginners
PDF
keras 빨리 훑어보기(intro)
PPTX
Image Deep Learning 실무적용
PDF
딥러닝기본-신경망기초
PDF
[신경망기초] 선형회귀분석
해커에게 전해들은 머신러닝 #4
해커에게 전해들은 머신러닝 #1
Learning to remember rare events
MNIST for ML beginners
keras 빨리 훑어보기(intro)
Image Deep Learning 실무적용
딥러닝기본-신경망기초
[신경망기초] 선형회귀분석

What's hot (20)

PPTX
Cnn 발표자료
PPTX
Focal loss의 응용(Detection & Classification)
PDF
확통 회귀분석
PDF
[Paper] eXplainable ai(xai) in computer vision
PPTX
A neural image caption generator
PDF
집단지성 프로그래밍 07-고급 분류 기법-커널 기법과 svm-01
PDF
밑바닥부터 시작하는딥러닝 8장
PDF
Deep Learning Into Advance - 1. Image, ConvNet
PDF
3.unsupervised learing
PPTX
Knowing when to look : Adaptive Attention via A Visual Sentinel for Image Cap...
PPTX
머피의 머신러닝 : Gaussian Processes
PPTX
Denoising auto encoders(d a)
PDF
Support Vector Machines
PPTX
Anomaly Detection with GANs
PPTX
Recurrent Neural Net의 이론과 설명
PDF
[신경망기초] 신경망의시작-퍼셉트론
PDF
내가 이해하는 SVM(왜, 어떻게를 중심으로)
PPTX
알기쉬운 Variational autoencoder
PDF
정수론적 알고리즘 - Sogang ICPC Team, 2020 Winter
Cnn 발표자료
Focal loss의 응용(Detection & Classification)
확통 회귀분석
[Paper] eXplainable ai(xai) in computer vision
A neural image caption generator
집단지성 프로그래밍 07-고급 분류 기법-커널 기법과 svm-01
밑바닥부터 시작하는딥러닝 8장
Deep Learning Into Advance - 1. Image, ConvNet
3.unsupervised learing
Knowing when to look : Adaptive Attention via A Visual Sentinel for Image Cap...
머피의 머신러닝 : Gaussian Processes
Denoising auto encoders(d a)
Support Vector Machines
Anomaly Detection with GANs
Recurrent Neural Net의 이론과 설명
[신경망기초] 신경망의시작-퍼셉트론
내가 이해하는 SVM(왜, 어떻게를 중심으로)
알기쉬운 Variational autoencoder
정수론적 알고리즘 - Sogang ICPC Team, 2020 Winter
Ad

Similar to Digit recognizer (20)

PDF
3.neural networks
PPTX
Variational AutoEncoder(VAE)
PDF
Naive ML Overview
PPT
3ds maxscript 튜토리얼_20151206_서진택
PPTX
2.supervised learning(epoch#2)-3
PDF
이정근_project_로봇비전시스템.pdf
PDF
세그먼트 트리 느리게 업데이트하기 - Sogang ICPC Team, 2020 Winter
PDF
[ShaderX5] 4.4 Edge Masking and Per-Texel Depth Extent Propagation For Comput...
PDF
딥러닝을 위한 Tensor flow(skt academy)
PDF
알고리즘 연합캠프 세미나 1-C (알고리즘 설계와 모델링 및 수학)
PDF
딥러닝계의 블루오션, Apache MXNet 공헌하기 - 윤석찬 (AWS 테크에반젤리스트) 오규삼 (삼성 SDS)
PPTX
PDF
Adversarial Attack in Neural Machine Translation
PDF
Support Vector Machine Tutorial 한국어
PDF
개발자를 위한 공감세미나 tensor-flow
PDF
고등학생 R&E Python summary for test
PDF
4.convolutional neural networks
PPTX
KOOC Ch8. k-means & GMM
PDF
[신경망기초] 소프트맥스회귀분석
PPTX
딥 러닝 자연어 처리 학습을 위한 PPT! (Deep Learning for Natural Language Processing)
3.neural networks
Variational AutoEncoder(VAE)
Naive ML Overview
3ds maxscript 튜토리얼_20151206_서진택
2.supervised learning(epoch#2)-3
이정근_project_로봇비전시스템.pdf
세그먼트 트리 느리게 업데이트하기 - Sogang ICPC Team, 2020 Winter
[ShaderX5] 4.4 Edge Masking and Per-Texel Depth Extent Propagation For Comput...
딥러닝을 위한 Tensor flow(skt academy)
알고리즘 연합캠프 세미나 1-C (알고리즘 설계와 모델링 및 수학)
딥러닝계의 블루오션, Apache MXNet 공헌하기 - 윤석찬 (AWS 테크에반젤리스트) 오규삼 (삼성 SDS)
Adversarial Attack in Neural Machine Translation
Support Vector Machine Tutorial 한국어
개발자를 위한 공감세미나 tensor-flow
고등학생 R&E Python summary for test
4.convolutional neural networks
KOOC Ch8. k-means & GMM
[신경망기초] 소프트맥스회귀분석
딥 러닝 자연어 처리 학습을 위한 PPT! (Deep Learning for Natural Language Processing)
Ad

More from Chul Ju Hong (8)

PDF
Mixture model
PDF
Rails antipattern-public
PDF
Rails antipatterns
PDF
Node.js intro
PDF
게임 클론하기
PDF
안드로이드 세미나 2
PDF
안드로이드 세미나
PDF
협업 툴 사용법
Mixture model
Rails antipattern-public
Rails antipatterns
Node.js intro
게임 클론하기
안드로이드 세미나 2
안드로이드 세미나
협업 툴 사용법

Digit recognizer

  • 2. 발표자 소개 홍철주 • http://blog.fegs.kr • https://github.com/FeGs • Machine Learning Newbie • SW Maestro 5th 2
  • 3. 목차 • 문제 소개 • k-NN, … • Dimensionality Reduction • 다시 k-NN, … • Neural Networks 3
  • 4. 문제 소개 데이터 : 손으로 쓴 숫자 이미지 (28px * 28px, grayscale) 목적 변수 : 숫자 (0, 1, 2, …, 9) 0 1 2 3 4 5 4 손으로 적은 숫자들을 분류하기 학습 데이터 : 42000개 테스트 데이터 : 28000개
  • 5. Example: MNIST (kaggle) […, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 23, 210, 254, 253, 159, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, …] 784차원 공간을 생각해보자 : Method 1: k-NN Method 2: SVM Method 3: Random Forest, etc.. 784차원 공간에서 가까이 있는 좌표의 label은? 784차원 공간을 783차원 초평면으로 갈라서 분류해보면? 이 위치에 하얀 픽셀이 있고 저기엔 없으면? 어떤 방법이 가장 좋은가? 5 기억나시는지?
  • 6. Feature? […, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 23, 210, 254, 253, 159, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, …] 이미지의 픽셀값을 feature로 이용 feature0 feature1 feature2 … feature783
  • 7. k-NN 784차원 공간에서 가까이 있는 좌표의 label은? sklearn.neighbors.KNeighborsClassifier(n_neighbors=10, weights='distance', algorithm='auto', leaf_size=30, p=2, metric='minkowski', metric_params=None) Accuracy = 96.65% 10-fold CV
  • 8. RF 이 위치에 하얀 픽셀이 있고 저기엔 없으면? (784개의 feature) Accuracy = 90.28% sklearn.ensemble.RandomForestClassifier(n_estimators=100, criterion='gini', max_depth=None, min_samples_split=2, min_samples_leaf=1, max_features='auto', max_leaf_nodes=None, bootstrap=True, oob_score=False, n_jobs=1, random_state=None, verbose=0, min_density=None, compute_importances=None) 10-fold CV 시간이 오래 걸림.
  • 10. PCA Principal component analysis 다시 설명하면 v v = a1e1 + a2e2 + … + anen (n = dim(v)) v 는 t = [a1, a2, …, an]로 표현 가능, ||t|| = n 근데 e1, e2, …, en 대신 w1, w2, …, wm을 쓰면 v ~= b1w1 + b2w2 + … + bmwm 처럼 되더라 v 는 u = [b1, b2, …, bm]으로도 표현 가능, ||u|| = m
  • 11. PCA Principal component analysis w1, w2, …, wm 의 정의는? http://www.stat.cmu.edu/~cshalizi/350/lectures/10/lecture-10.pdf실제로 구하는 방법은 ->
  • 12. PCA + k-NN 10차원으로 낮췄을 때 : 92.6% 33차원으로 낮췄을 때 : 97.3% 5 3 8 9 56차원으로 낮췄을 때 : 97.2% 차원을 낮추고 학습시키면? sklearn.neighbors.KNeighborsClassifier(n_neighbors=10, weights='distance', algorithm='auto', leaf_size=30, p=2, metric='minkowski', metric_params=None) 10-fold CV
  • 13. PCA + RF 10차원으로 낮췄을 때 : 89.9% 33차원으로 낮췄을 때 : 95.2% 5 3 8 9 56차원으로 낮췄을 때 : 95.1% 차원을 낮추고 학습시키면? 10-fold CV sklearn.ensemble.RandomForestClassifier(n_estimators=200, criterion='gini', max_depth=None, min_samples_split=2, min_samples_leaf=1, max_features='auto', max_leaf_nodes=None, bootstrap=True, oob_score=False, n_jobs=1, random_state=None, verbose=0, min_density=None, compute_importances=None)
  • 14. Deep Learning • 간단한 역사를 설명하면 • 인공신경망 연구는 오류 역전파 알고리즘으로 … • 하지만 학습에 시간이 오래 걸리고, Overfitting, … • 그러다가 하드웨어도 좋아지고 이걸 빅데이터가? • Local minima 이슈는 High-dimension non-convex optimization에서는 별로.. • RBM, DBN에 대한 이야기는 넘어가고 NN 이야기만.. http://www.slideshare.net/secondmath/deep-learning-by-jskim
  • 19. Logistic function Logistic function의 일반화 Softmax function Sigmoid function
  • 21. Gradient Descent 지역 최적점을 찾아서
  • 22. BP Algorithm Weight, bias의 보정
  • 23. MLP Multi Layer Perceptron Hidden Layer 가 여러 층
  • 24. MLP Multi Layer Perceptron input0 input1 output0 output1 hidden0 hidden1 hidden2 x Layer0 Layer1 Layer2 W b0 z = Wx + b tanh y = tanh(z)
  • 25. MLP Multi Layer Perceptron input0 input1 output0 output1 hidden0 hidden1 hidden2 x Layer0 Layer1 Layer2 W b0 z = Wx + b tanh y = tanh(z) Hidden Layer
  • 26. MLP Multi Layer Perceptron output0 output1 hidden0 hidden1 hidden2 Layer1 Layer2 W b0 z = Wx + b tanh y = tanh(z) softmax y_pred argmax z = Wx + b b1
  • 27. z = Wx + b b1 MLP Multi Layer Perceptron output0 output1 hidden0 hidden1 hidden2 Layer1 Layer2 W b0 z = Wx + b tanh y = tanh(z) softmax y_pred argmax Logistic Regression
  • 31. CNN Convolutional Neural Network Convolution Layer MLP
  • 33. CNN 여기까지 오느라 수고하셨습니다- Convolutional neural networks 1. convolution layer (feature map = 4, 5*5) 2. max pooling layer (2*2) 3. convolution layer (feature map = 10, 5*5) 4. max pooling layer (2*2) 5. hidden layer (500 neurons, tanh activation) 6. output layer (500 -> 10, logistic regression) Accuracy = 96.74% 10-fold CV 발표자료 만들고보니 feature 맵을 잘못 넣었다는 것을 깨달음 제대로 했으면 sample 수는 적지만 98+%도 가능한지는 다음에 것보다 kaggle에서 원래 데이터를 다 안 줌 =_=
  • 34. EOF