15、Dropout原理以及其TF/Torch/Numpy源码实现

1. 伯努利分布

伯努利分布也叫0,1分布,为1的概率为p,为0的概率为1-p

x 0 1
p 1-p p
x^2 0 1
p 1-p p
  • 期望E(x):
    E ( x ) = 0 ⋅ ( 1 − p ) + 1 ⋅ p = p \begin{equation} \mathrm{E}(x)= 0\cdot(1-p)+1\cdot p=p \end{equation} E(x)=0(1p)+1p=p
  • 期望E(x^2):
    E ( x 2 ) = 0 2 ⋅ ( 1 − p ) + 1 2 ⋅ p = p \begin{equation} \mathrm{E}(x^2)= 0^2\cdot(1-p)+1^2\cdot p=p \end{equation} E(x2)=02(1p)+12p=p
  • 方差 D(x):
    D ( x ) = E ( x 2 ) − [ E ( x ) ] 2 = p − p 2 \begin{equation} \mathrm{D}(x)= \mathrm{E}(x^2)-[\mathrm{E}(x)]^2=p-p^2 \end{equation} D(x)=E(x2)[E(x)]2=pp2
  • python
import numpy as np

np.set_printoptions(suppress=True, precision=3)
np.random.seed(335435)

if __name__ == "__main__":
    run_code = 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值