当前位置:网站首页>深度学习1感知机及实现简单反向传播网络
深度学习1感知机及实现简单反向传播网络
2022-07-21 16:49:00 【强仔fight】
感知机是什么?
感知机接受多个输入信号,输出一个信号
感知机的信号只有“流/不流”两种取值,0对应“不传递信号”,1对应“传递信号”。
输入信号在被送往神经元时,会被分别乘以固定的权重。神经元会计算传送过来的信号的总和,只有当这个总和超过某个界限值时,才会输出1。这也称为“神经元被激活”。
上述内容用数学式来表示,就是:
y=0(w1x1+w2x2<=θ)
1 (w1x1+w2x2>θ)
简单逻辑电路
与门 and gate:与门是具有两个输出和一个输入的门电路。 与门仅在两个输入均为1时输出1,其他时候输出0
与非门 NAND 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
导入权重和偏置
y=0(b+w1x1+w2x2<=0)
1(b+w1x1+w2x2>0)
偏置的值决定了神经元被激活的容易程度
感知机的局限性
异或门,仅当x1和x2中的一方为1时,才会输出1.
一条直线无法分开 真值表中的4个点
曲线分割的空间称为非线性空间,直线分割的空间称为线性空间。
多层感知机
异或门的实现
AND函数。NAND函数。OR函数。叠加
def XOR(x1, x2):
s1= NAND(x1,x2)
s2= OR(x1,x2)
y=AND(s1,s2)
return y
反向传播网络
#定义激活函数
import numpy as np
def sigmoid(x, deriv=Flase)
if deriv==True:
return x*(1-x)
return 1/(1+np.exp(-x))
#网络结构
w0 = np.random.random(( , ))
w1 = np.random.random(( , ))
#前向传播
l0 = x
l1 = sigmoid(np.dot(l0, w0))
l2 = sigmoid(np.dot(l1,w1))
l2_error = l2 - y
#反向传播
l2_delta = l2_error * sigmode(l2, deriv=True)
l1_error = np.dot(l2_delta, w1.T)
l1_delta = l1_error*sigmode(l1, deriv=True)
#更新参数
w1-=l1.T .dot( l2_delta)
w0-=l0.T .dot( l1_delta)
边栏推荐
- Move! What if you can't take the PMP Exam?
- Property dataSource is required 异常处理 [IDEA]
- 官网收藏...
- 接口文档进化图鉴,有些古早接口文档工具,你可能都没用过
- jmter---数据库性能测试
- Information sharing | hc-05 Bluetooth module information
- 物理地址介绍「建议收藏」
- 特征选择小结:过滤式、包裹式、嵌入式
- Fastjson 代码执行 CVE-2022-25845
- R language uses oneway The test function performs one-way ANOVA. If there is the same variance between groups, set the var.equal parameter to true to obtain a more relaxed test
猜你喜欢
Percona XtraDB Cluster安装
性能测试总体测试框架
Airflow详细搭建过程(亲测 + 总结)
Notes on formal languages and compilers & tutorial Chapter 2 context free languages
Geek planet ByteDance one stop data governance solution and platform architecture
Lombok comments @accessories
跟我读论文丨Multi-Model Text Recognition Network
快速傅里叶变换 ,拉格朗日插值法,三千字附例题,姊妹篇FFT与字符串匹配的应用
Web3 couldn't escape the palm of these old giants
Read the paper with me - multi model text recognition network
随机推荐
R language tests the significance of correlation coefficient: use cor.test function to calculate the value and confidence interval of correlation coefficient and its statistical significance (if the v
如何设计产品MVP实现价值最大化
快速傅里叶变换 ,拉格朗日插值法,三千字附例题,姊妹篇FFT与字符串匹配的应用
PMP考生注意,这些地区考试将延期
R language uses the mean function to calculate the relative frequency of the specified variables in the sample (observation) data: calculate the proportion of the observation samples in the dataframe
There is garbled code in the JSON string generated by rapidjson
js原生——数组排序 去重 找出最大数 字符串出现最多的字符
Official website Collection
Interface document evolution atlas, some ancient interface document tools, you may not have used them
Matrix multiplication and division of two elements "suggestions collection"
Overview of nftfi track layout
跟我读论文丨Multi-Model Text Recognition Network
架构师进阶,微服务设计与治理的 16 条常用原则
R语言检验样本比例:使用prop.test函数执行单样本比例检验(检验成功样本所占的比例是否大于指定的比例值p)
剑指 Offer II 001. 整数除法
資料分享|HC-05藍牙模塊資料
Extjs4实例地址和中文文档地址
Next.js 与 Remix
微信支付Native(一)准备和相关知识
Qt5 static link OpenSSL error handling