SlideShare a Scribd company logo
!1
심층신경망 훈련
http://jaejunyoo.blogspot.com/2017/01/backpropagation.html
https://medium.com/@karpathy/yes-you-should-understand-backprop-e2f06eab496b
“Yes	you	should	understand	backprop”	
"The	problem	with	Backpropagation	is	that	it	is	a	leaky	abstraction."
심층신경망에서는 Gradient Descent 가 잘 동작하지 않는다.
WHY?
!2
심층신경망 필요성
예측정확도
단일 = 심층
학습속도
단일 < 심층
!3
[FUNCTION] : dataset_minmax
[FUNCTION] : normalize_dataset
[FUNCTION] : evaluate_algorithm
[FUNCTION] : cross_validation_split
[FUNCTION] : back_propagation
[FUNCTION] : initialize_network
[FUNCTION] : train_network
심층신경망 학습 과정
>전처리
소스참고 : https://machinelearningmastery.com/implement-backpropagation-algorithm-scratch-python/
3 different varieties of wheat: Kama, Rosa and Canadian.
!4
[FUNCTION] : forward_propagate
[FUNCTION] : activate
[FUNCTION] : transfer
반복 (n_hidden + 3 회)
[FUNCTION] : backward_propagate_error
[FUNCTION] : transfer_derivative
반복 (n_hidden + 3 회)
[FUNCTION] : update_weights
심층신경망 학습 과정
> 학습
(3회 : Output layer count. In this case, 3 class classification)
!5
[FUNCTION] : forward_propagate
[FUNCTION] : activate
[FUNCTION] : transfer
반복 (n_hidden + 3 회)
[FUNCTION] : backward_propagate_error
[FUNCTION] : transfer_derivative
반복 (n_hidden + 3 회)
[FUNCTION] : update_weights
!6
[FUNCTION] : forward_propagate
[FUNCTION] : activate
[FUNCTION] : transfer
반복 (n_hidden + 3 회)
[FUNCTION] : backward_propagate_error
[FUNCTION] : transfer_derivative
반복 (n_hidden + 3 회)
[FUNCTION] : update_weights
arr[-1] : last element of arr
ㄴ s(x) sigmoid
!7
[FUNCTION] : forward_propagate
[FUNCTION] : activate
[FUNCTION] : transfer
반복 (n_hidden + 3 회)
[FUNCTION] : backward_propagate_error
[FUNCTION] : transfer_derivative
반복 (n_hidden + 3 회)
[FUNCTION] : update_weights
!8
def backward_propagate_error(network, expected):
# print("[FUNCTION] : ",inspect.getframeinfo(inspect.currentframe()).function)
print("-------")
pprint(network)
print(expected)
# sys.exit()
for i in reversed(range(len(network))):
layer = network[i]
errors = list()
if i != len(network)-1:
for j in range(len(layer)):
error = 0.0
for neuron in network[i + 1]:
error += (neuron['weights'][j] * neuron['delta'])
errors.append(error)
else:
for j in range(len(layer)):
neuron = layer[j]
errors.append(expected[j] - neuron['output'])
for j in range(len(layer)):
neuron = layer[j]
neuron['delta'] = errors[j] * transfer_derivative(neuron['output'])
-------
[[{'delta': -0.002105481132614655,
'output': 0.9875157273476414,
'weights': [0.9705506423302226,
0.6235470249087426,
0.6877117204824573,
0.443648677014938,
0.5175984164765586,
0.026815578055486865,
0.6666448293753904,
0.7888475556891129]}],
[{'delta': -0.14733500412100667,
'output': 0.6043751101552216,
'weights': [0.3395066691207968, 0.08846035870939582]},
{'delta': -0.14316208422738091,
'output': 0.5598784626677785,
'weights': [0.4300707928355212, -0.1840328525536184]},
{'delta': 0.10301622967407513,
'output': 0.6026972589408445,
'weights': [0.29927233284033017, 0.12118031505837243]}]]
[0, 0, 1]
-------
[[{'delta': -0.0009853373984217329,
'output': 0.9176180659068145,
'weights': [0.9700677432652737,
0.6230543562095318,
0.6873639017456279,
0.44318707751297465,
0.5171204962344873,
0.02656030703409016,
0.6662089230964726,
0.7883548869899021]}],
[{'delta': -0.1445096162009705,
'output': 0.5651938383437569,
'weights': [0.26815390974508185, 0.016205550608910574]},
{'delta': -0.13796221046736146,
'output': 0.5197693625175647,
'weights': [0.3619508665274388, -0.2530139577872991]},
{'delta': 0.09513544172088485,
'output': 0.619274457702868,
'weights': [0.34624620530409955, 0.16874803591881485]}]]
[1, 0, 0]
-------
# Transfer neuron activation
def transfer(activation):
# print("[FUNCTION] : ",inspect.getframeinfo(inspect.currentframe()).function)
return 1.0 / (1.0 + exp(-activation))
# Calculate the derivative of an neuron output
def transfer_derivative(output):
# print("[FUNCTION] : ",inspect.getframeinfo(inspect.currentframe()).function)
return output * (1.0 - output)
!9
Sigmoid
transferred derivative
= d/dx(Sigmoid)
!10
[FUNCTION] : forward_propagate
[FUNCTION] : activate
[FUNCTION] : transfer
반복 (n_hidden + 3 회)
[FUNCTION] : backward_propagate_error
[FUNCTION] : transfer_derivative
반복 (n_hidden + 3 회)
[FUNCTION] : update_weights
!11
[FUNCTION] : forward_propagate
[FUNCTION] : activate
[FUNCTION] : transfer
반복 (n_hidden + 3 회)
[FUNCTION] : backward_propagate_error
[FUNCTION] : transfer_derivative
반복 (n_hidden + 3 회)
[FUNCTION] : update_weights
!12
네스테로프 가속 경사 추가
!13
hyper parameter test
학습률 : 0.01 학습률 : 0.10 학습률 : 0.50 학습률 : 1.00
학습률이 적을 수록 그래프가 많이 튀는 현상
“학습률이 너무 낮아서 초기화된 weight 값에서 쉽게 벗어나지 못하는 모습”
!14
학습률 : 0.30
!15
학습률 : 1.00
!16
Relu?
!17
~33% ~70% ~85% ~85% ~75%
for n_epoch in (3, 6, 9, 12, 15, 18, 21):
for n_hidden in (3, 6, 9, 12, 15, 18, 21):
!18
for n_epoch in (5, 10, 15, 20, 25, 30, 35):
for n_hidden in (5, 10, 15, 20, 25, 30, 35):
!19
sigmoid
> layer 가 많을 때, Gradient 소실
relu
> learning rate 에 따라 예민
ELU?
!20
!21
# Transfer neuron activation
def transfer(activation):
# print("[FUNCTION] : ",inspect.getframeinfo(inspect.currentframe()).function)
## sigmoid
# return 1.0 / (1.0 + exp(-activation))
## ReLu
# return max(0, activation)
## Elu
if(activation>=0):
return activation
else:
return (exp(activation)-1)
# Calculate the derivative of an neuron output
def transfer_derivative(output):
# print("[FUNCTION] : ",inspect.getframeinfo(inspect.currentframe()).function)
## sigmoid
# return output * (1.0 - output)
## ReLu
# if(output > 0):
# return 1
# else:
# return 0
## Elu
if(output > 0):
return 1
else:
return (exp(output)-1)
!22
for n_epoch in (5, 10, 20, 35):
for n_hidden in (5, 10, 20, 35):
!23
for n_epoch in (5, 10, 15, 20, 25, 30, 35):
for n_hidden in (5, 10, 15, 20, 25, 30, 35):
n_epoch, n_hidden 5 5
n_epoch, n_hidden 5 10
n_epoch, n_hidden 5 15
n_epoch, n_hidden 5 20
n_epoch, n_hidden 5 25
n_epoch, n_hidden 5 30
n_epoch, n_hidden 5 35
n_epoch, n_hidden 10 5
n_epoch, n_hidden 10 10
n_epoch, n_hidden 10 15
n_epoch, n_hidden 10 20
n_epoch, n_hidden 10 25
n_epoch, n_hidden 10 30
n_epoch, n_hidden 10 35
n_epoch, n_hidden 15 5
n_epoch, n_hidden 15 10
n_epoch, n_hidden 15 15
n_epoch, n_hidden 15 20
n_epoch, n_hidden 15 25
n_epoch, n_hidden 15 30
n_epoch, n_hidden 15 35
n_epoch, n_hidden 20 5
n_epoch, n_hidden 20 10
n_epoch, n_hidden 20 15
n_epoch, n_hidden 20 20
n_epoch, n_hidden 20 25
n_epoch, n_hidden 20 30
n_epoch, n_hidden 20 35
n_epoch, n_hidden 25 5
n_epoch, n_hidden 25 10
n_epoch, n_hidden 25 15
n_epoch, n_hidden 25 20
n_epoch, n_hidden 25 25
n_epoch, n_hidden 25 30
n_epoch, n_hidden 25 35
n_epoch, n_hidden 30 5
n_epoch, n_hidden 30 10
n_epoch, n_hidden 30 15
n_epoch, n_hidden 30 20
n_epoch, n_hidden 30 25
n_epoch, n_hidden 30 30
n_epoch, n_hidden 30 35
n_epoch, n_hidden 35 5
n_epoch, n_hidden 35 10
n_epoch, n_hidden 35 15
n_epoch, n_hidden 35 20
n_epoch, n_hidden 35 25
n_epoch, n_hidden 35 30
18.6 s
!24
Continue…

More Related Content

Similar to make simple neural network python

Welcome to python
Welcome to pythonWelcome to python
Welcome to python
Kyunghoon Kim
 
14709302.ppt
14709302.ppt14709302.ppt
14709302.ppt
SunilChaluvaiah
 
The Ring programming language version 1.10 book - Part 70 of 212
The Ring programming language version 1.10 book - Part 70 of 212The Ring programming language version 1.10 book - Part 70 of 212
The Ring programming language version 1.10 book - Part 70 of 212
Mahmoud Samir Fayed
 
The Ring programming language version 1.7 book - Part 63 of 196
The Ring programming language version 1.7 book - Part 63 of 196The Ring programming language version 1.7 book - Part 63 of 196
The Ring programming language version 1.7 book - Part 63 of 196
Mahmoud Samir Fayed
 
Introduction to Coding
Introduction to CodingIntroduction to Coding
Introduction to Coding
Fabio506452
 
New SPL Features in PHP 5.3 (TEK-X)
New SPL Features in PHP 5.3 (TEK-X)New SPL Features in PHP 5.3 (TEK-X)
New SPL Features in PHP 5.3 (TEK-X)
Matthew Turland
 
PE보다 스크립트 - 핵인싸 악성코드의 진단 우회방식
PE보다 스크립트 - 핵인싸 악성코드의 진단 우회방식PE보다 스크립트 - 핵인싸 악성코드의 진단 우회방식
PE보다 스크립트 - 핵인싸 악성코드의 진단 우회방식
HeungSoo Kang
 
Application of recursive perturbation approach for multimodal optimization
Application of recursive perturbation approach for multimodal optimizationApplication of recursive perturbation approach for multimodal optimization
Application of recursive perturbation approach for multimodal optimization
Pranamesh Chakraborty
 
marko_go_in_badoo
marko_go_in_badoomarko_go_in_badoo
marko_go_in_badoo
Marko Kevac
 
Vertica trace
Vertica traceVertica trace
Vertica trace
Zvika Gutkin
 
The Ring programming language version 1.6 book - Part 62 of 189
The Ring programming language version 1.6 book - Part 62 of 189The Ring programming language version 1.6 book - Part 62 of 189
The Ring programming language version 1.6 book - Part 62 of 189
Mahmoud Samir Fayed
 
Czzawk
CzzawkCzzawk
Czzawk
宗志 陈
 
CSS parsing: performance tips & tricks
CSS parsing: performance tips & tricksCSS parsing: performance tips & tricks
CSS parsing: performance tips & tricks
Roman Dvornov
 
Explain this!
Explain this!Explain this!
Explain this!
Fabio Telles Rodriguez
 
Nodejs性能分析优化和分布式设计探讨
Nodejs性能分析优化和分布式设计探讨Nodejs性能分析优化和分布式设计探讨
Nodejs性能分析优化和分布式设计探讨
flyinweb
 
COSCUP: Introduction to Julia
COSCUP: Introduction to JuliaCOSCUP: Introduction to Julia
COSCUP: Introduction to Julia
岳華 杜
 
Assignment 5.2.pdf
Assignment 5.2.pdfAssignment 5.2.pdf
Assignment 5.2.pdf
dash41
 
Ruby Outside Rails 2 (southfest)
Ruby Outside Rails 2 (southfest)Ruby Outside Rails 2 (southfest)
Ruby Outside Rails 2 (southfest)
Victor Petrenko
 
Tensor flow description of ML Lab. document
Tensor flow description of ML Lab. documentTensor flow description of ML Lab. document
Tensor flow description of ML Lab. document
jeongok1
 
Александр Зимин – Анимация как средство самовыражения
Александр Зимин – Анимация как средство самовыраженияАлександр Зимин – Анимация как средство самовыражения
Александр Зимин – Анимация как средство самовыражения
CocoaHeads
 

Similar to make simple neural network python (20)

Welcome to python
Welcome to pythonWelcome to python
Welcome to python
 
14709302.ppt
14709302.ppt14709302.ppt
14709302.ppt
 
The Ring programming language version 1.10 book - Part 70 of 212
The Ring programming language version 1.10 book - Part 70 of 212The Ring programming language version 1.10 book - Part 70 of 212
The Ring programming language version 1.10 book - Part 70 of 212
 
The Ring programming language version 1.7 book - Part 63 of 196
The Ring programming language version 1.7 book - Part 63 of 196The Ring programming language version 1.7 book - Part 63 of 196
The Ring programming language version 1.7 book - Part 63 of 196
 
Introduction to Coding
Introduction to CodingIntroduction to Coding
Introduction to Coding
 
New SPL Features in PHP 5.3 (TEK-X)
New SPL Features in PHP 5.3 (TEK-X)New SPL Features in PHP 5.3 (TEK-X)
New SPL Features in PHP 5.3 (TEK-X)
 
PE보다 스크립트 - 핵인싸 악성코드의 진단 우회방식
PE보다 스크립트 - 핵인싸 악성코드의 진단 우회방식PE보다 스크립트 - 핵인싸 악성코드의 진단 우회방식
PE보다 스크립트 - 핵인싸 악성코드의 진단 우회방식
 
Application of recursive perturbation approach for multimodal optimization
Application of recursive perturbation approach for multimodal optimizationApplication of recursive perturbation approach for multimodal optimization
Application of recursive perturbation approach for multimodal optimization
 
marko_go_in_badoo
marko_go_in_badoomarko_go_in_badoo
marko_go_in_badoo
 
Vertica trace
Vertica traceVertica trace
Vertica trace
 
The Ring programming language version 1.6 book - Part 62 of 189
The Ring programming language version 1.6 book - Part 62 of 189The Ring programming language version 1.6 book - Part 62 of 189
The Ring programming language version 1.6 book - Part 62 of 189
 
Czzawk
CzzawkCzzawk
Czzawk
 
CSS parsing: performance tips & tricks
CSS parsing: performance tips & tricksCSS parsing: performance tips & tricks
CSS parsing: performance tips & tricks
 
Explain this!
Explain this!Explain this!
Explain this!
 
Nodejs性能分析优化和分布式设计探讨
Nodejs性能分析优化和分布式设计探讨Nodejs性能分析优化和分布式设计探讨
Nodejs性能分析优化和分布式设计探讨
 
COSCUP: Introduction to Julia
COSCUP: Introduction to JuliaCOSCUP: Introduction to Julia
COSCUP: Introduction to Julia
 
Assignment 5.2.pdf
Assignment 5.2.pdfAssignment 5.2.pdf
Assignment 5.2.pdf
 
Ruby Outside Rails 2 (southfest)
Ruby Outside Rails 2 (southfest)Ruby Outside Rails 2 (southfest)
Ruby Outside Rails 2 (southfest)
 
Tensor flow description of ML Lab. document
Tensor flow description of ML Lab. documentTensor flow description of ML Lab. document
Tensor flow description of ML Lab. document
 
Александр Зимин – Анимация как средство самовыражения
Александр Зимин – Анимация как средство самовыраженияАлександр Зимин – Анимация как средство самовыражения
Александр Зимин – Анимация как средство самовыражения
 

More from 아르떼소피

페이지 권한 공유 방법
페이지 권한 공유 방법페이지 권한 공유 방법
페이지 권한 공유 방법아르떼소피
 
소상공인을 위한 저렴하고 효과적인 모바일 홈 상품들!
소상공인을 위한 저렴하고 효과적인 모바일 홈 상품들!소상공인을 위한 저렴하고 효과적인 모바일 홈 상품들!
소상공인을 위한 저렴하고 효과적인 모바일 홈 상품들!
아르떼소피
 
2014년 2월 나스미디어 Media Trend 미디어 동향 & 신규 광고 상품
2014년 2월 나스미디어 Media Trend 미디어 동향 & 신규 광고 상품2014년 2월 나스미디어 Media Trend 미디어 동향 & 신규 광고 상품
2014년 2월 나스미디어 Media Trend 미디어 동향 & 신규 광고 상품
아르떼소피
 
라이크미 페이스북 광고 소개서
라이크미 페이스북 광고 소개서라이크미 페이스북 광고 소개서
라이크미 페이스북 광고 소개서
아르떼소피
 
페이스북 홍보 최고의 앱, 라이크미 서비스 가이드
페이스북 홍보 최고의 앱, 라이크미 서비스 가이드페이스북 홍보 최고의 앱, 라이크미 서비스 가이드
페이스북 홍보 최고의 앱, 라이크미 서비스 가이드
아르떼소피
 
라이크미 서비스 가이드
라이크미 서비스 가이드라이크미 서비스 가이드
라이크미 서비스 가이드
아르떼소피
 
페이스북 브랜드 마케팅 라이크미 (2013.11.08)
페이스북 브랜드 마케팅   라이크미 (2013.11.08)페이스북 브랜드 마케팅   라이크미 (2013.11.08)
페이스북 브랜드 마케팅 라이크미 (2013.11.08)
아르떼소피
 

More from 아르떼소피 (7)

페이지 권한 공유 방법
페이지 권한 공유 방법페이지 권한 공유 방법
페이지 권한 공유 방법
 
소상공인을 위한 저렴하고 효과적인 모바일 홈 상품들!
소상공인을 위한 저렴하고 효과적인 모바일 홈 상품들!소상공인을 위한 저렴하고 효과적인 모바일 홈 상품들!
소상공인을 위한 저렴하고 효과적인 모바일 홈 상품들!
 
2014년 2월 나스미디어 Media Trend 미디어 동향 & 신규 광고 상품
2014년 2월 나스미디어 Media Trend 미디어 동향 & 신규 광고 상품2014년 2월 나스미디어 Media Trend 미디어 동향 & 신규 광고 상품
2014년 2월 나스미디어 Media Trend 미디어 동향 & 신규 광고 상품
 
라이크미 페이스북 광고 소개서
라이크미 페이스북 광고 소개서라이크미 페이스북 광고 소개서
라이크미 페이스북 광고 소개서
 
페이스북 홍보 최고의 앱, 라이크미 서비스 가이드
페이스북 홍보 최고의 앱, 라이크미 서비스 가이드페이스북 홍보 최고의 앱, 라이크미 서비스 가이드
페이스북 홍보 최고의 앱, 라이크미 서비스 가이드
 
라이크미 서비스 가이드
라이크미 서비스 가이드라이크미 서비스 가이드
라이크미 서비스 가이드
 
페이스북 브랜드 마케팅 라이크미 (2013.11.08)
페이스북 브랜드 마케팅   라이크미 (2013.11.08)페이스북 브랜드 마케팅   라이크미 (2013.11.08)
페이스북 브랜드 마케팅 라이크미 (2013.11.08)
 

Recently uploaded

EWOCS-I: The catalog of X-ray sources in Westerlund 1 from the Extended Weste...
EWOCS-I: The catalog of X-ray sources in Westerlund 1 from the Extended Weste...EWOCS-I: The catalog of X-ray sources in Westerlund 1 from the Extended Weste...
EWOCS-I: The catalog of X-ray sources in Westerlund 1 from the Extended Weste...
Sérgio Sacani
 
The use of Nauplii and metanauplii artemia in aquaculture (brine shrimp).pptx
The use of Nauplii and metanauplii artemia in aquaculture (brine shrimp).pptxThe use of Nauplii and metanauplii artemia in aquaculture (brine shrimp).pptx
The use of Nauplii and metanauplii artemia in aquaculture (brine shrimp).pptx
MAGOTI ERNEST
 
Phenomics assisted breeding in crop improvement
Phenomics assisted breeding in crop improvementPhenomics assisted breeding in crop improvement
Phenomics assisted breeding in crop improvement
IshaGoswami9
 
Cytokines and their role in immune regulation.pptx
Cytokines and their role in immune regulation.pptxCytokines and their role in immune regulation.pptx
Cytokines and their role in immune regulation.pptx
Hitesh Sikarwar
 
原版制作(carleton毕业证书)卡尔顿大学毕业证硕士文凭原版一模一样
原版制作(carleton毕业证书)卡尔顿大学毕业证硕士文凭原版一模一样原版制作(carleton毕业证书)卡尔顿大学毕业证硕士文凭原版一模一样
原版制作(carleton毕业证书)卡尔顿大学毕业证硕士文凭原版一模一样
yqqaatn0
 
Medical Orthopedic PowerPoint Templates.pptx
Medical Orthopedic PowerPoint Templates.pptxMedical Orthopedic PowerPoint Templates.pptx
Medical Orthopedic PowerPoint Templates.pptx
terusbelajar5
 
Immersive Learning That Works: Research Grounding and Paths Forward
Immersive Learning That Works: Research Grounding and Paths ForwardImmersive Learning That Works: Research Grounding and Paths Forward
Immersive Learning That Works: Research Grounding and Paths Forward
Leonel Morgado
 
Sharlene Leurig - Enabling Onsite Water Use with Net Zero Water
Sharlene Leurig - Enabling Onsite Water Use with Net Zero WaterSharlene Leurig - Enabling Onsite Water Use with Net Zero Water
Sharlene Leurig - Enabling Onsite Water Use with Net Zero Water
Texas Alliance of Groundwater Districts
 
20240520 Planning a Circuit Simulator in JavaScript.pptx
20240520 Planning a Circuit Simulator in JavaScript.pptx20240520 Planning a Circuit Simulator in JavaScript.pptx
20240520 Planning a Circuit Simulator in JavaScript.pptx
Sharon Liu
 
aziz sancar nobel prize winner: from mardin to nobel
aziz sancar nobel prize winner: from mardin to nobelaziz sancar nobel prize winner: from mardin to nobel
aziz sancar nobel prize winner: from mardin to nobel
İsa Badur
 
Applied Science: Thermodynamics, Laws & Methodology.pdf
Applied Science: Thermodynamics, Laws & Methodology.pdfApplied Science: Thermodynamics, Laws & Methodology.pdf
Applied Science: Thermodynamics, Laws & Methodology.pdf
University of Hertfordshire
 
Deep Software Variability and Frictionless Reproducibility
Deep Software Variability and Frictionless ReproducibilityDeep Software Variability and Frictionless Reproducibility
Deep Software Variability and Frictionless Reproducibility
University of Rennes, INSA Rennes, Inria/IRISA, CNRS
 
如何办理(uvic毕业证书)维多利亚大学毕业证本科学位证书原版一模一样
如何办理(uvic毕业证书)维多利亚大学毕业证本科学位证书原版一模一样如何办理(uvic毕业证书)维多利亚大学毕业证本科学位证书原版一模一样
如何办理(uvic毕业证书)维多利亚大学毕业证本科学位证书原版一模一样
yqqaatn0
 
SAR of Medicinal Chemistry 1st by dk.pdf
SAR of Medicinal Chemistry 1st by dk.pdfSAR of Medicinal Chemistry 1st by dk.pdf
SAR of Medicinal Chemistry 1st by dk.pdf
KrushnaDarade1
 
bordetella pertussis.................................ppt
bordetella pertussis.................................pptbordetella pertussis.................................ppt
bordetella pertussis.................................ppt
kejapriya1
 
ESR spectroscopy in liquid food and beverages.pptx
ESR spectroscopy in liquid food and beverages.pptxESR spectroscopy in liquid food and beverages.pptx
ESR spectroscopy in liquid food and beverages.pptx
PRIYANKA PATEL
 
Compexometric titration/Chelatorphy titration/chelating titration
Compexometric titration/Chelatorphy titration/chelating titrationCompexometric titration/Chelatorphy titration/chelating titration
Compexometric titration/Chelatorphy titration/chelating titration
Vandana Devesh Sharma
 
8.Isolation of pure cultures and preservation of cultures.pdf
8.Isolation of pure cultures and preservation of cultures.pdf8.Isolation of pure cultures and preservation of cultures.pdf
8.Isolation of pure cultures and preservation of cultures.pdf
by6843629
 
在线办理(salfor毕业证书)索尔福德大学毕业证毕业完成信一模一样
在线办理(salfor毕业证书)索尔福德大学毕业证毕业完成信一模一样在线办理(salfor毕业证书)索尔福德大学毕业证毕业完成信一模一样
在线办理(salfor毕业证书)索尔福德大学毕业证毕业完成信一模一样
vluwdy49
 
Remote Sensing and Computational, Evolutionary, Supercomputing, and Intellige...
Remote Sensing and Computational, Evolutionary, Supercomputing, and Intellige...Remote Sensing and Computational, Evolutionary, Supercomputing, and Intellige...
Remote Sensing and Computational, Evolutionary, Supercomputing, and Intellige...
University of Maribor
 

Recently uploaded (20)

EWOCS-I: The catalog of X-ray sources in Westerlund 1 from the Extended Weste...
EWOCS-I: The catalog of X-ray sources in Westerlund 1 from the Extended Weste...EWOCS-I: The catalog of X-ray sources in Westerlund 1 from the Extended Weste...
EWOCS-I: The catalog of X-ray sources in Westerlund 1 from the Extended Weste...
 
The use of Nauplii and metanauplii artemia in aquaculture (brine shrimp).pptx
The use of Nauplii and metanauplii artemia in aquaculture (brine shrimp).pptxThe use of Nauplii and metanauplii artemia in aquaculture (brine shrimp).pptx
The use of Nauplii and metanauplii artemia in aquaculture (brine shrimp).pptx
 
Phenomics assisted breeding in crop improvement
Phenomics assisted breeding in crop improvementPhenomics assisted breeding in crop improvement
Phenomics assisted breeding in crop improvement
 
Cytokines and their role in immune regulation.pptx
Cytokines and their role in immune regulation.pptxCytokines and their role in immune regulation.pptx
Cytokines and their role in immune regulation.pptx
 
原版制作(carleton毕业证书)卡尔顿大学毕业证硕士文凭原版一模一样
原版制作(carleton毕业证书)卡尔顿大学毕业证硕士文凭原版一模一样原版制作(carleton毕业证书)卡尔顿大学毕业证硕士文凭原版一模一样
原版制作(carleton毕业证书)卡尔顿大学毕业证硕士文凭原版一模一样
 
Medical Orthopedic PowerPoint Templates.pptx
Medical Orthopedic PowerPoint Templates.pptxMedical Orthopedic PowerPoint Templates.pptx
Medical Orthopedic PowerPoint Templates.pptx
 
Immersive Learning That Works: Research Grounding and Paths Forward
Immersive Learning That Works: Research Grounding and Paths ForwardImmersive Learning That Works: Research Grounding and Paths Forward
Immersive Learning That Works: Research Grounding and Paths Forward
 
Sharlene Leurig - Enabling Onsite Water Use with Net Zero Water
Sharlene Leurig - Enabling Onsite Water Use with Net Zero WaterSharlene Leurig - Enabling Onsite Water Use with Net Zero Water
Sharlene Leurig - Enabling Onsite Water Use with Net Zero Water
 
20240520 Planning a Circuit Simulator in JavaScript.pptx
20240520 Planning a Circuit Simulator in JavaScript.pptx20240520 Planning a Circuit Simulator in JavaScript.pptx
20240520 Planning a Circuit Simulator in JavaScript.pptx
 
aziz sancar nobel prize winner: from mardin to nobel
aziz sancar nobel prize winner: from mardin to nobelaziz sancar nobel prize winner: from mardin to nobel
aziz sancar nobel prize winner: from mardin to nobel
 
Applied Science: Thermodynamics, Laws & Methodology.pdf
Applied Science: Thermodynamics, Laws & Methodology.pdfApplied Science: Thermodynamics, Laws & Methodology.pdf
Applied Science: Thermodynamics, Laws & Methodology.pdf
 
Deep Software Variability and Frictionless Reproducibility
Deep Software Variability and Frictionless ReproducibilityDeep Software Variability and Frictionless Reproducibility
Deep Software Variability and Frictionless Reproducibility
 
如何办理(uvic毕业证书)维多利亚大学毕业证本科学位证书原版一模一样
如何办理(uvic毕业证书)维多利亚大学毕业证本科学位证书原版一模一样如何办理(uvic毕业证书)维多利亚大学毕业证本科学位证书原版一模一样
如何办理(uvic毕业证书)维多利亚大学毕业证本科学位证书原版一模一样
 
SAR of Medicinal Chemistry 1st by dk.pdf
SAR of Medicinal Chemistry 1st by dk.pdfSAR of Medicinal Chemistry 1st by dk.pdf
SAR of Medicinal Chemistry 1st by dk.pdf
 
bordetella pertussis.................................ppt
bordetella pertussis.................................pptbordetella pertussis.................................ppt
bordetella pertussis.................................ppt
 
ESR spectroscopy in liquid food and beverages.pptx
ESR spectroscopy in liquid food and beverages.pptxESR spectroscopy in liquid food and beverages.pptx
ESR spectroscopy in liquid food and beverages.pptx
 
Compexometric titration/Chelatorphy titration/chelating titration
Compexometric titration/Chelatorphy titration/chelating titrationCompexometric titration/Chelatorphy titration/chelating titration
Compexometric titration/Chelatorphy titration/chelating titration
 
8.Isolation of pure cultures and preservation of cultures.pdf
8.Isolation of pure cultures and preservation of cultures.pdf8.Isolation of pure cultures and preservation of cultures.pdf
8.Isolation of pure cultures and preservation of cultures.pdf
 
在线办理(salfor毕业证书)索尔福德大学毕业证毕业完成信一模一样
在线办理(salfor毕业证书)索尔福德大学毕业证毕业完成信一模一样在线办理(salfor毕业证书)索尔福德大学毕业证毕业完成信一模一样
在线办理(salfor毕业证书)索尔福德大学毕业证毕业完成信一模一样
 
Remote Sensing and Computational, Evolutionary, Supercomputing, and Intellige...
Remote Sensing and Computational, Evolutionary, Supercomputing, and Intellige...Remote Sensing and Computational, Evolutionary, Supercomputing, and Intellige...
Remote Sensing and Computational, Evolutionary, Supercomputing, and Intellige...
 

make simple neural network python

  • 2. !2 심층신경망 필요성 예측정확도 단일 = 심층 학습속도 단일 < 심층
  • 3. !3 [FUNCTION] : dataset_minmax [FUNCTION] : normalize_dataset [FUNCTION] : evaluate_algorithm [FUNCTION] : cross_validation_split [FUNCTION] : back_propagation [FUNCTION] : initialize_network [FUNCTION] : train_network 심층신경망 학습 과정 >전처리 소스참고 : https://machinelearningmastery.com/implement-backpropagation-algorithm-scratch-python/ 3 different varieties of wheat: Kama, Rosa and Canadian.
  • 4. !4 [FUNCTION] : forward_propagate [FUNCTION] : activate [FUNCTION] : transfer 반복 (n_hidden + 3 회) [FUNCTION] : backward_propagate_error [FUNCTION] : transfer_derivative 반복 (n_hidden + 3 회) [FUNCTION] : update_weights 심층신경망 학습 과정 > 학습 (3회 : Output layer count. In this case, 3 class classification)
  • 5. !5 [FUNCTION] : forward_propagate [FUNCTION] : activate [FUNCTION] : transfer 반복 (n_hidden + 3 회) [FUNCTION] : backward_propagate_error [FUNCTION] : transfer_derivative 반복 (n_hidden + 3 회) [FUNCTION] : update_weights
  • 6. !6 [FUNCTION] : forward_propagate [FUNCTION] : activate [FUNCTION] : transfer 반복 (n_hidden + 3 회) [FUNCTION] : backward_propagate_error [FUNCTION] : transfer_derivative 반복 (n_hidden + 3 회) [FUNCTION] : update_weights arr[-1] : last element of arr ㄴ s(x) sigmoid
  • 7. !7 [FUNCTION] : forward_propagate [FUNCTION] : activate [FUNCTION] : transfer 반복 (n_hidden + 3 회) [FUNCTION] : backward_propagate_error [FUNCTION] : transfer_derivative 반복 (n_hidden + 3 회) [FUNCTION] : update_weights
  • 8. !8 def backward_propagate_error(network, expected): # print("[FUNCTION] : ",inspect.getframeinfo(inspect.currentframe()).function) print("-------") pprint(network) print(expected) # sys.exit() for i in reversed(range(len(network))): layer = network[i] errors = list() if i != len(network)-1: for j in range(len(layer)): error = 0.0 for neuron in network[i + 1]: error += (neuron['weights'][j] * neuron['delta']) errors.append(error) else: for j in range(len(layer)): neuron = layer[j] errors.append(expected[j] - neuron['output']) for j in range(len(layer)): neuron = layer[j] neuron['delta'] = errors[j] * transfer_derivative(neuron['output']) ------- [[{'delta': -0.002105481132614655, 'output': 0.9875157273476414, 'weights': [0.9705506423302226, 0.6235470249087426, 0.6877117204824573, 0.443648677014938, 0.5175984164765586, 0.026815578055486865, 0.6666448293753904, 0.7888475556891129]}], [{'delta': -0.14733500412100667, 'output': 0.6043751101552216, 'weights': [0.3395066691207968, 0.08846035870939582]}, {'delta': -0.14316208422738091, 'output': 0.5598784626677785, 'weights': [0.4300707928355212, -0.1840328525536184]}, {'delta': 0.10301622967407513, 'output': 0.6026972589408445, 'weights': [0.29927233284033017, 0.12118031505837243]}]] [0, 0, 1] ------- [[{'delta': -0.0009853373984217329, 'output': 0.9176180659068145, 'weights': [0.9700677432652737, 0.6230543562095318, 0.6873639017456279, 0.44318707751297465, 0.5171204962344873, 0.02656030703409016, 0.6662089230964726, 0.7883548869899021]}], [{'delta': -0.1445096162009705, 'output': 0.5651938383437569, 'weights': [0.26815390974508185, 0.016205550608910574]}, {'delta': -0.13796221046736146, 'output': 0.5197693625175647, 'weights': [0.3619508665274388, -0.2530139577872991]}, {'delta': 0.09513544172088485, 'output': 0.619274457702868, 'weights': [0.34624620530409955, 0.16874803591881485]}]] [1, 0, 0] ------- # Transfer neuron activation def transfer(activation): # print("[FUNCTION] : ",inspect.getframeinfo(inspect.currentframe()).function) return 1.0 / (1.0 + exp(-activation)) # Calculate the derivative of an neuron output def transfer_derivative(output): # print("[FUNCTION] : ",inspect.getframeinfo(inspect.currentframe()).function) return output * (1.0 - output)
  • 10. !10 [FUNCTION] : forward_propagate [FUNCTION] : activate [FUNCTION] : transfer 반복 (n_hidden + 3 회) [FUNCTION] : backward_propagate_error [FUNCTION] : transfer_derivative 반복 (n_hidden + 3 회) [FUNCTION] : update_weights
  • 11. !11 [FUNCTION] : forward_propagate [FUNCTION] : activate [FUNCTION] : transfer 반복 (n_hidden + 3 회) [FUNCTION] : backward_propagate_error [FUNCTION] : transfer_derivative 반복 (n_hidden + 3 회) [FUNCTION] : update_weights
  • 13. !13 hyper parameter test 학습률 : 0.01 학습률 : 0.10 학습률 : 0.50 학습률 : 1.00 학습률이 적을 수록 그래프가 많이 튀는 현상 “학습률이 너무 낮아서 초기화된 weight 값에서 쉽게 벗어나지 못하는 모습”
  • 17. !17 ~33% ~70% ~85% ~85% ~75% for n_epoch in (3, 6, 9, 12, 15, 18, 21): for n_hidden in (3, 6, 9, 12, 15, 18, 21):
  • 18. !18 for n_epoch in (5, 10, 15, 20, 25, 30, 35): for n_hidden in (5, 10, 15, 20, 25, 30, 35):
  • 19. !19 sigmoid > layer 가 많을 때, Gradient 소실 relu > learning rate 에 따라 예민 ELU?
  • 20. !20
  • 21. !21 # Transfer neuron activation def transfer(activation): # print("[FUNCTION] : ",inspect.getframeinfo(inspect.currentframe()).function) ## sigmoid # return 1.0 / (1.0 + exp(-activation)) ## ReLu # return max(0, activation) ## Elu if(activation>=0): return activation else: return (exp(activation)-1) # Calculate the derivative of an neuron output def transfer_derivative(output): # print("[FUNCTION] : ",inspect.getframeinfo(inspect.currentframe()).function) ## sigmoid # return output * (1.0 - output) ## ReLu # if(output > 0): # return 1 # else: # return 0 ## Elu if(output > 0): return 1 else: return (exp(output)-1)
  • 22. !22 for n_epoch in (5, 10, 20, 35): for n_hidden in (5, 10, 20, 35):
  • 23. !23 for n_epoch in (5, 10, 15, 20, 25, 30, 35): for n_hidden in (5, 10, 15, 20, 25, 30, 35): n_epoch, n_hidden 5 5 n_epoch, n_hidden 5 10 n_epoch, n_hidden 5 15 n_epoch, n_hidden 5 20 n_epoch, n_hidden 5 25 n_epoch, n_hidden 5 30 n_epoch, n_hidden 5 35 n_epoch, n_hidden 10 5 n_epoch, n_hidden 10 10 n_epoch, n_hidden 10 15 n_epoch, n_hidden 10 20 n_epoch, n_hidden 10 25 n_epoch, n_hidden 10 30 n_epoch, n_hidden 10 35 n_epoch, n_hidden 15 5 n_epoch, n_hidden 15 10 n_epoch, n_hidden 15 15 n_epoch, n_hidden 15 20 n_epoch, n_hidden 15 25 n_epoch, n_hidden 15 30 n_epoch, n_hidden 15 35 n_epoch, n_hidden 20 5 n_epoch, n_hidden 20 10 n_epoch, n_hidden 20 15 n_epoch, n_hidden 20 20 n_epoch, n_hidden 20 25 n_epoch, n_hidden 20 30 n_epoch, n_hidden 20 35 n_epoch, n_hidden 25 5 n_epoch, n_hidden 25 10 n_epoch, n_hidden 25 15 n_epoch, n_hidden 25 20 n_epoch, n_hidden 25 25 n_epoch, n_hidden 25 30 n_epoch, n_hidden 25 35 n_epoch, n_hidden 30 5 n_epoch, n_hidden 30 10 n_epoch, n_hidden 30 15 n_epoch, n_hidden 30 20 n_epoch, n_hidden 30 25 n_epoch, n_hidden 30 30 n_epoch, n_hidden 30 35 n_epoch, n_hidden 35 5 n_epoch, n_hidden 35 10 n_epoch, n_hidden 35 15 n_epoch, n_hidden 35 20 n_epoch, n_hidden 35 25 n_epoch, n_hidden 35 30 18.6 s