Пример #1
0
    internal static void UpdateBiasNodeWeight(Weight weightForPrevLayer, double delta, double momentumMagnitude)
    {
        var change = -delta;

        weightForPrevLayer.Adjust(change);

        if (weightForPrevLayer is IWeightWithMomentum weightForPrevLayerAsWeightWithMomentum)
        {
            var changeFromMomentum = momentumMagnitude * weightForPrevLayerAsWeightWithMomentum.Momentum;
            weightForPrevLayer.Adjust(changeFromMomentum);
            weightForPrevLayerAsWeightWithMomentum.Momentum = change + changeFromMomentum;
        }
    }
Пример #2
0
    internal static void UpdateNodeWeight(Node prevNode, Weight weightForPrevNode, double delta, double momentumMagnitude)
    {
        var change = -(delta * prevNode.Output);

        weightForPrevNode.Adjust(change);

        if (weightForPrevNode is IWeightWithMomentum weightForPrevNodeAsWeightWithMomentum)
        {
            var changeFromMomentum = momentumMagnitude * weightForPrevNodeAsWeightWithMomentum.Momentum;
            weightForPrevNode.Adjust(changeFromMomentum);
            weightForPrevNodeAsWeightWithMomentum.Momentum = change + changeFromMomentum;
        }
    }