【问题标题】:Neural network - output is converging to 0, python神经网络 - 输出收敛到 0,python
【发布时间】:2013-04-03 15:46:42
【问题描述】:

我正在尝试使用简单的反向传播和 one-hot 编码将 2D 数据分为多层神经网络中的 3 个类别。在我将增量学习更改为批量学习后,我的输出收敛到 0 ([0,0,0]),主要是在我使用更多数据或更高学习速度的情况下。我不知道我是否必须派生其他东西,或者我是否在代码中犯了一些错误。

for each epoch: #pseudocode
    for each input:
        caluclate hiden neurons activations (logsig)
        calculate output neurons activations (logsig)

        #error propagation   
        for i in range(3):  
            error = (desired_out[i] - aktivations_out[i])
            error_out[i] = error * deriv_logsig(aktivations_out[i])             
        t_weights_out = zip(*weights_out)           
        for i in range(hiden_neurons):  
            sum_error = sum(e*w for e, w in zip(error_out, t_weights_out[i]))               
            error_h[i] =  sum_error * deriv_logsig(input_out[i])

        #cumulate deltas             
        for i in range(len(weights_out)):                               
            delta_out[i] = [d + x * coef * error_out[i] for d, x in zip(delta_out[i],        input_out)]               
        for i in range(len(weights_h)):
            delta_h[i] = [d + x * coef * error_h[i] for d, x in zip(delta_h[i], input)]

    #batch learning after epoch
    for i in range(len(weights_out)):                               
            weights_out[i] = [w + delta for w, delta in zip(weights_out[i], delta_out[i])]
    for i in range(len(weights_h)):
            weights_h[i] = [w + delta for w, delta in zip(weights_h[i], delta_h[i])]

【问题讨论】:

    标签: python machine-learning neural-network backpropagation


    【解决方案1】:

    我会尝试一些玩具示例,我可以确定 NN 会如何表现和调试我的代码。如果我确定我的代码是有效的 NN 并且我仍然没有得到好的结果,我会尝试更改 NN 的参数。但这可能会非常耗时,因此我会选择一些更简单的 ML 技术,例如不是黑盒的决策树作为NN。使用决策树,您应该可以更轻松、更快地找到解决方案。问题是您是否可以在 NN 以外的地方实现它...

    【讨论】:

      猜你喜欢
      • 2017-10-28
      • 2012-03-03
      • 2018-11-04
      • 2016-05-13
      • 2016-07-10
      • 1970-01-01
      • 2014-06-24
      • 2019-02-20
      相关资源
      最近更新 更多