SlideShare ist ein Scribd-Unternehmen logo
1 von 34
Downloaden Sie, um offline zu lesen
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

Weitere ähnliche Inhalte

Was ist angesagt?

머피의 머신러닝 : Gaussian Processes
머피의 머신러닝 : Gaussian Processes머피의 머신러닝 : Gaussian Processes
머피의 머신러닝 : Gaussian Processes
Jungkyu Lee
 

Was ist angesagt? (20)

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

Ähnlich wie Digit recognizer

[ShaderX5] 4.4 Edge Masking and Per-Texel Depth Extent Propagation For Comput...
[ShaderX5] 4.4 Edge Masking and Per-Texel Depth Extent Propagation For Comput...[ShaderX5] 4.4 Edge Masking and Per-Texel Depth Extent Propagation For Comput...
[ShaderX5] 4.4 Edge Masking and Per-Texel Depth Extent Propagation For Comput...
종빈 오
 

Ähnlich wie Digit recognizer (20)

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

Mehr von Chul Ju Hong (8)

Mixture model
Mixture modelMixture model
Mixture model
 
Rails antipattern-public
Rails antipattern-publicRails antipattern-public
Rails antipattern-public
 
Rails antipatterns
Rails antipatternsRails antipatterns
Rails antipatterns
 
Node.js intro
Node.js introNode.js intro
Node.js intro
 
게임 클론하기
게임 클론하기게임 클론하기
게임 클론하기
 
안드로이드 세미나 2
안드로이드 세미나 2안드로이드 세미나 2
안드로이드 세미나 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