efficient_pd_weight_updates.py 文件源码

python
阅读 69 收藏 0 点赞 0 评论 0

项目:pdnn 作者: petered 项目源码 文件源码
def scalar_weight_updates(xc, ec, kp, kd):

    tx_last = 0
    te_last = 0
    x_last = 0
    e_last = 0
    n_samples = xc.shape[0]
    dw = np.zeros(n_samples)
    r = kd/float(kp+kd)

    for t in xrange(n_samples):

        t_last = max(tx_last, te_last)
        if xc[t]:
            dw[t] = x_last*e_last*r**(2*t_last-tx_last-te_last)*geosum(r**2, t_end=t-t_last+1, t_start=1)
            x_last = x_last * r**(t-tx_last) + xc[t]
            tx_last = t
        if ec[t]:
            dw[t] = x_last*e_last*r**(2*t_last-tx_last-te_last)*geosum(r**2, t_end=t-t_last+1, t_start=1)  # THing...
            e_last = e_last * r**(t-te_last) + ec[t]
            te_last = t
    return np.cumsum(dw)/kd**2
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号