当前位置:网站首页>Deep learning 1 perceptron and implementation of simple back propagation network
Deep learning 1 perceptron and implementation of simple back propagation network
2022-07-24 14:20:00 【Strong fight】
What is a perceptron ?
The sensor receives multiple input signals , Output a signal
The sensor's signal is only “ flow / No flow ” Two values ,0 Corresponding “ No signal transmission ”,1 Corresponding “ Signal transmission ”.
Input signals are sent to neurons , Will be multiplied by a fixed weight . The neurons calculate the sum of the signals they send , Only when the sum exceeds a certain threshold , Will be output 1. This is also called “ Neurons are activated ”.
The above contents are expressed by mathematical formula , Namely :
y=0(w1x1+w2x2<=θ)
1 (w1x1+w2x2>θ)
Simple logic circuit
And gate and gate: And gate is a gate circuit with two outputs and one input . And gate only when both inputs are 1 Time output 1, Output at other times 0
NAND gate NAND gate
Or gate
The implementation of perceptron
Implementation of and gate
def AND(x1,x2):
w1,w2,theta = 0.5,0.5,0.7
tmp = w1*x1+w2*x2
if tmp <= theta:
return 0
elif tmp > theta:
return 1
Import weights and offsets
y=0(b+w1x1+w2x2<=0)
1(b+w1x1+w2x2>0)
The value of bias determines how easily neurons are activated
Limitations of perceptron
Exclusive OR gate , Only when the x1 and x2 One of them is 1 when , Will be output 1.
A straight line cannot be separated In truth table 4 A little bit
The space divided by curves is called nonlinear space , The space divided by straight lines is called linear space .
Multilayer perceptron
The implementation of XOR gates
AND function .NAND function .OR function . superposition
def XOR(x1, x2):
s1= NAND(x1,x2)
s2= OR(x1,x2)
y=AND(s1,s2)
return y
Back propagation network
# Define activation function
import numpy as np
def sigmoid(x, deriv=Flase)
if deriv==True:
return x*(1-x)
return 1/(1+np.exp(-x))
# Network structure
w0 = np.random.random(( , ))
w1 = np.random.random(( , ))
# Forward propagation
l0 = x
l1 = sigmoid(np.dot(l0, w0))
l2 = sigmoid(np.dot(l1,w1))
l2_error = l2 - y
# Back propagation
l2_delta = l2_error * sigmode(l2, deriv=True)
l1_error = np.dot(l2_delta, w1.T)
l1_delta = l1_error*sigmode(l1, deriv=True)
# Update parameters
w1-=l1.T .dot( l2_delta)
w0-=l0.T .dot( l1_delta)
边栏推荐
- Unity 委托 (Delegate) 的简单理解以及实现
- Build ZABBIX monitoring service in LNMP architecture
- OWASP zap security testing tool tutorial (Advanced)
- Nessus security testing tool tutorial
- Learn science minimize
- 学习scipy minimize
- Apache2 ha experiment with raspberry pie
- AtCoder Beginner Contest 261E // 按位思考 + dp
- Mmdrawercontroller gets the current VC for push and pop
- JS judge whether the data is empty
猜你喜欢

Detailed explanation of IO model (easy to understand)

Uni app background audio will not be played after the screen is turned off or returned to the desktop

2022.7.22 simulation match

Notes on the use of IEEE transaction journal template

正则表达和绕过案例

Don't lose heart. The famous research on the explosive influence of Yolo and PageRank has been rejected by the CS summit

Solve the problem that the ARR containsobject method returns no every time

Not configured in app.json (uni releases wechat applet)

Dialog manager Chapter 2: create frame window

5年接触近百位老板,身为猎头的我,发现升职的秘密不过4个字
随机推荐
C operator priority memory formula
TypeError: 'str' object does not support item assignment
Click event to create a new node
Solve the problem that the ARR containsobject method returns no every time
C multithreaded lock collation record
Binlog and iptables prevent nmap scanning, xtrabackup full + incremental backup, and the relationship between redlog and binlog
Differences between C language pointer and array A and &a, &a[0], etc
bibliometrix: 从千万篇论文中挖掘出最值得读的那一篇!
Where can Huatai Securities open an account? Is it safe to use a mobile phone
本机异步网络通信执行快于同步指令
2.4. properties of special profile
Ztree tree Metro style mouse through the display user-defined controls add, edit, delete, down, up operations
String - Sword finger offer 58 - ii Rotate string left
C language -- program environment and preprocessing
Error importing header file to PCH
【C语言笔记分享】——动态内存管理malloc、free、calloc、realloc、柔性数组
茅台冰淇淋“逆势”走红,跨界之意却并不在“卖雪糕”
JS get object attribute value
TS learning record (I) sudo forgets the password (oolong) try changing the 'lib' compiler option to include 'DOM'
Flink advanced features and new features (VIII) V2