【问题标题】:Neural Network Initialization - Nguyen Widrow Implementation?神经网络初始化 - Nguyen Widrow 实现?
【发布时间】:2013-01-14 19:25:41
【问题描述】:

我已经尝试实现 Nguyen Widrow 算法(如下),它似乎运行正常,但我有一些后续问题:

  • 这看起来像一个正确的实现吗?

  • Nguyen Widrow 初始化是否适用于任何网络拓扑 / 尺寸 ? (即5层AutoEncoder)

  • Nguyen Widrow 初始化对任何输入范围都有效吗? (0/1、-1/+1 等)

  • Nguyen Widrow 初始化对任何激活函数都有效吗? (即 Logistic、Tanh、Linear)

下面的代码假设网络已经被随机化为-1/+1:

        ' Calculate the number of hidden neurons
        Dim HiddenNeuronsCount As Integer = Me.TotalNeuronsCount - (Me.InputsCount - Me.OutputsCount)

        ' Calculate the Beta value for all hidden layers
        Dim Beta As Double = (0.7 * Math.Pow(HiddenNeuronsCount, (1.0 / Me.InputsCount)))

        ' Loop through each layer in neural network, skipping input layer
        For i As Integer = 1 To Layers.GetUpperBound(0)

            ' Loop through each neuron in layer
            For j As Integer = 0 To Layers(i).Neurons.GetUpperBound(0)

                Dim InputsNorm As Double = 0

                ' Loop through each weight in neuron inputs, add weight value to InputsNorm
                For k As Integer = 0 To Layers(i).Neurons(j).ConnectionWeights.GetUpperBound(0)
                    InputsNorm += Layers(i).Neurons(j).ConnectionWeights(k) * Layers(i).Neurons(j).ConnectionWeights(k)
                Next

                ' Add bias value to InputsNorm
                InputsNorm += Layers(i).Neurons(j).Bias * Layers(i).Neurons(j).Bias

                ' Finalize euclidean norm calculation
                InputsNorm = Math.Sqrt(InputsNorm)

                ' Loop through each weight in neuron inputs, scale the weight based on euclidean norm and beta
                For k As Integer = 0 To Layers(i).Neurons(j).ConnectionWeights.GetUpperBound(0)
                    Layers(i).Neurons(j).ConnectionWeights(k) = (Beta * Layers(i).Neurons(j).ConnectionWeights(k)) / InputsNorm
                Next

                ' Scale the bias based on euclidean norm and beta
                Layers(i).Neurons(j).Bias = (Beta * Layers(i).Neurons(j).Bias) / InputsNorm

            Next

        Next

【问题讨论】:

    标签: initialization neural-network


    【解决方案1】:

    Nguyen & Widrow 在他们的论文中假设输入介于 -1 和 +1 之间。 Nguyen Widrow 初始化对任何长度有限的激活函数都有效。 同样在他们的论文中,他们只讨论了 2 层神经网络,不确定 5 层神经网络。

    S

    【讨论】:

    • 如果您有更多层,您只需将算法应用于每个层。检查this question
    猜你喜欢
    • 1970-01-01
    • 2016-01-19
    • 1970-01-01
    • 2020-02-08
    • 2019-10-09
    • 2021-06-25
    • 1970-01-01
    • 2012-04-29
    相关资源
    最近更新 更多