NN.py 文件源码

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

项目:MachineLearningProjects 作者: geallen 项目源码 文件源码
def updateWeights(W1, b1, W2, b2, alpha, d_W1, d_W2, d_b1, d_b2):
    ## YOUR CODE HERE ##
    # W1 = 0
    # b1 = 0
    # W2 = 0
    # b2 = 0

    ## Here we should update weights with usin the result that we found in calcGrads function

    ## W1 is weights between input and the hidden layer
    W1 = W1 - alpha * (np.transpose(d_W1)) # 400*30
    ## W2 is weights between output and the hidden layer
    W2 = W2 - alpha * (np.transpose(d_W2)) # 30*5
    ## b1 is weights between input bias and the hidden layer
    b1 = b1 - alpha * d_b1
    ## b2 is weights between hidden layer bias and the output layer
    b2 = b2 - alpha * (np.transpose(d_b2))
    ####################
    return W1, b1, W2, b2
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号