SlideShare a Scribd company logo
1 of 24
Download to read offline
!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

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 212Mahmoud 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 196Mahmoud Samir Fayed
 
Introduction to Coding
Introduction to CodingIntroduction to Coding
Introduction to CodingFabio506452
 
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 optimizationPranamesh Chakraborty
 
marko_go_in_badoo
marko_go_in_badoomarko_go_in_badoo
marko_go_in_badooMarko Kevac
 
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 189Mahmoud Samir Fayed
 
CSS parsing: performance tips & tricks
CSS parsing: performance tips & tricksCSS parsing: performance tips & tricks
CSS parsing: performance tips & tricksRoman Dvornov
 
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.pdfdash41
 
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. documentjeongok1
 
Александр Зимин – Анимация как средство самовыражения
Александр Зимин – Анимация как средство самовыраженияАлександр Зимин – Анимация как средство самовыражения
Александр Зимин – Анимация как средство самовыражения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

Luciferase in rDNA technology (biotechnology).pptx
Luciferase in rDNA technology (biotechnology).pptxLuciferase in rDNA technology (biotechnology).pptx
Luciferase in rDNA technology (biotechnology).pptxAleenaTreesaSaji
 
Module 4: Mendelian Genetics and Punnett Square
Module 4:  Mendelian Genetics and Punnett SquareModule 4:  Mendelian Genetics and Punnett Square
Module 4: Mendelian Genetics and Punnett SquareIsiahStephanRadaza
 
Isotopic evidence of long-lived volcanism on Io
Isotopic evidence of long-lived volcanism on IoIsotopic evidence of long-lived volcanism on Io
Isotopic evidence of long-lived volcanism on IoSérgio Sacani
 
Hubble Asteroid Hunter III. Physical properties of newly found asteroids
Hubble Asteroid Hunter III. Physical properties of newly found asteroidsHubble Asteroid Hunter III. Physical properties of newly found asteroids
Hubble Asteroid Hunter III. Physical properties of newly found asteroidsSérgio Sacani
 
Is RISC-V ready for HPC workload? Maybe?
Is RISC-V ready for HPC workload? Maybe?Is RISC-V ready for HPC workload? Maybe?
Is RISC-V ready for HPC workload? Maybe?Patrick Diehl
 
Call Girls in Munirka Delhi 💯Call Us 🔝9953322196🔝 💯Escort.
Call Girls in Munirka Delhi 💯Call Us 🔝9953322196🔝 💯Escort.Call Girls in Munirka Delhi 💯Call Us 🔝9953322196🔝 💯Escort.
Call Girls in Munirka Delhi 💯Call Us 🔝9953322196🔝 💯Escort.aasikanpl
 
Behavioral Disorder: Schizophrenia & it's Case Study.pdf
Behavioral Disorder: Schizophrenia & it's Case Study.pdfBehavioral Disorder: Schizophrenia & it's Case Study.pdf
Behavioral Disorder: Schizophrenia & it's Case Study.pdfSELF-EXPLANATORY
 
Scheme-of-Work-Science-Stage-4 cambridge science.docx
Scheme-of-Work-Science-Stage-4 cambridge science.docxScheme-of-Work-Science-Stage-4 cambridge science.docx
Scheme-of-Work-Science-Stage-4 cambridge science.docxyaramohamed343013
 
Orientation, design and principles of polyhouse
Orientation, design and principles of polyhouseOrientation, design and principles of polyhouse
Orientation, design and principles of polyhousejana861314
 
SOLUBLE PATTERN RECOGNITION RECEPTORS.pptx
SOLUBLE PATTERN RECOGNITION RECEPTORS.pptxSOLUBLE PATTERN RECOGNITION RECEPTORS.pptx
SOLUBLE PATTERN RECOGNITION RECEPTORS.pptxkessiyaTpeter
 
Biopesticide (2).pptx .This slides helps to know the different types of biop...
Biopesticide (2).pptx  .This slides helps to know the different types of biop...Biopesticide (2).pptx  .This slides helps to know the different types of biop...
Biopesticide (2).pptx .This slides helps to know the different types of biop...RohitNehra6
 
Nanoparticles synthesis and characterization​ ​
Nanoparticles synthesis and characterization​  ​Nanoparticles synthesis and characterization​  ​
Nanoparticles synthesis and characterization​ ​kaibalyasahoo82800
 
Grafana in space: Monitoring Japan's SLIM moon lander in real time
Grafana in space: Monitoring Japan's SLIM moon lander  in real timeGrafana in space: Monitoring Japan's SLIM moon lander  in real time
Grafana in space: Monitoring Japan's SLIM moon lander in real timeSatoshi NAKAHIRA
 
STERILITY TESTING OF PHARMACEUTICALS ppt by DR.C.P.PRINCE
STERILITY TESTING OF PHARMACEUTICALS ppt by DR.C.P.PRINCESTERILITY TESTING OF PHARMACEUTICALS ppt by DR.C.P.PRINCE
STERILITY TESTING OF PHARMACEUTICALS ppt by DR.C.P.PRINCEPRINCE C P
 
Neurodevelopmental disorders according to the dsm 5 tr
Neurodevelopmental disorders according to the dsm 5 trNeurodevelopmental disorders according to the dsm 5 tr
Neurodevelopmental disorders according to the dsm 5 trssuser06f238
 
Recombination DNA Technology (Nucleic Acid Hybridization )
Recombination DNA Technology (Nucleic Acid Hybridization )Recombination DNA Technology (Nucleic Acid Hybridization )
Recombination DNA Technology (Nucleic Acid Hybridization )aarthirajkumar25
 
Artificial Intelligence In Microbiology by Dr. Prince C P
Artificial Intelligence In Microbiology by Dr. Prince C PArtificial Intelligence In Microbiology by Dr. Prince C P
Artificial Intelligence In Microbiology by Dr. Prince C PPRINCE C P
 
Analytical Profile of Coleus Forskohlii | Forskolin .pptx
Analytical Profile of Coleus Forskohlii | Forskolin .pptxAnalytical Profile of Coleus Forskohlii | Forskolin .pptx
Analytical Profile of Coleus Forskohlii | Forskolin .pptxSwapnil Therkar
 

Recently uploaded (20)

Luciferase in rDNA technology (biotechnology).pptx
Luciferase in rDNA technology (biotechnology).pptxLuciferase in rDNA technology (biotechnology).pptx
Luciferase in rDNA technology (biotechnology).pptx
 
The Philosophy of Science
The Philosophy of ScienceThe Philosophy of Science
The Philosophy of Science
 
Module 4: Mendelian Genetics and Punnett Square
Module 4:  Mendelian Genetics and Punnett SquareModule 4:  Mendelian Genetics and Punnett Square
Module 4: Mendelian Genetics and Punnett Square
 
Isotopic evidence of long-lived volcanism on Io
Isotopic evidence of long-lived volcanism on IoIsotopic evidence of long-lived volcanism on Io
Isotopic evidence of long-lived volcanism on Io
 
Hubble Asteroid Hunter III. Physical properties of newly found asteroids
Hubble Asteroid Hunter III. Physical properties of newly found asteroidsHubble Asteroid Hunter III. Physical properties of newly found asteroids
Hubble Asteroid Hunter III. Physical properties of newly found asteroids
 
Is RISC-V ready for HPC workload? Maybe?
Is RISC-V ready for HPC workload? Maybe?Is RISC-V ready for HPC workload? Maybe?
Is RISC-V ready for HPC workload? Maybe?
 
Call Girls in Munirka Delhi 💯Call Us 🔝9953322196🔝 💯Escort.
Call Girls in Munirka Delhi 💯Call Us 🔝9953322196🔝 💯Escort.Call Girls in Munirka Delhi 💯Call Us 🔝9953322196🔝 💯Escort.
Call Girls in Munirka Delhi 💯Call Us 🔝9953322196🔝 💯Escort.
 
Behavioral Disorder: Schizophrenia & it's Case Study.pdf
Behavioral Disorder: Schizophrenia & it's Case Study.pdfBehavioral Disorder: Schizophrenia & it's Case Study.pdf
Behavioral Disorder: Schizophrenia & it's Case Study.pdf
 
Scheme-of-Work-Science-Stage-4 cambridge science.docx
Scheme-of-Work-Science-Stage-4 cambridge science.docxScheme-of-Work-Science-Stage-4 cambridge science.docx
Scheme-of-Work-Science-Stage-4 cambridge science.docx
 
Orientation, design and principles of polyhouse
Orientation, design and principles of polyhouseOrientation, design and principles of polyhouse
Orientation, design and principles of polyhouse
 
SOLUBLE PATTERN RECOGNITION RECEPTORS.pptx
SOLUBLE PATTERN RECOGNITION RECEPTORS.pptxSOLUBLE PATTERN RECOGNITION RECEPTORS.pptx
SOLUBLE PATTERN RECOGNITION RECEPTORS.pptx
 
Biopesticide (2).pptx .This slides helps to know the different types of biop...
Biopesticide (2).pptx  .This slides helps to know the different types of biop...Biopesticide (2).pptx  .This slides helps to know the different types of biop...
Biopesticide (2).pptx .This slides helps to know the different types of biop...
 
Engler and Prantl system of classification in plant taxonomy
Engler and Prantl system of classification in plant taxonomyEngler and Prantl system of classification in plant taxonomy
Engler and Prantl system of classification in plant taxonomy
 
Nanoparticles synthesis and characterization​ ​
Nanoparticles synthesis and characterization​  ​Nanoparticles synthesis and characterization​  ​
Nanoparticles synthesis and characterization​ ​
 
Grafana in space: Monitoring Japan's SLIM moon lander in real time
Grafana in space: Monitoring Japan's SLIM moon lander  in real timeGrafana in space: Monitoring Japan's SLIM moon lander  in real time
Grafana in space: Monitoring Japan's SLIM moon lander in real time
 
STERILITY TESTING OF PHARMACEUTICALS ppt by DR.C.P.PRINCE
STERILITY TESTING OF PHARMACEUTICALS ppt by DR.C.P.PRINCESTERILITY TESTING OF PHARMACEUTICALS ppt by DR.C.P.PRINCE
STERILITY TESTING OF PHARMACEUTICALS ppt by DR.C.P.PRINCE
 
Neurodevelopmental disorders according to the dsm 5 tr
Neurodevelopmental disorders according to the dsm 5 trNeurodevelopmental disorders according to the dsm 5 tr
Neurodevelopmental disorders according to the dsm 5 tr
 
Recombination DNA Technology (Nucleic Acid Hybridization )
Recombination DNA Technology (Nucleic Acid Hybridization )Recombination DNA Technology (Nucleic Acid Hybridization )
Recombination DNA Technology (Nucleic Acid Hybridization )
 
Artificial Intelligence In Microbiology by Dr. Prince C P
Artificial Intelligence In Microbiology by Dr. Prince C PArtificial Intelligence In Microbiology by Dr. Prince C P
Artificial Intelligence In Microbiology by Dr. Prince C P
 
Analytical Profile of Coleus Forskohlii | Forskolin .pptx
Analytical Profile of Coleus Forskohlii | Forskolin .pptxAnalytical Profile of Coleus Forskohlii | Forskolin .pptx
Analytical Profile of Coleus Forskohlii | Forskolin .pptx
 

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