T
T
Taras Serevann2018-12-17 13:20:06
Python
Taras Serevann, 2018-12-17 13:20:06

Why does the wrong derivative work better?

Hello! Write a multilayer perceptron with backpropagation according to this tutorial
It uses the logistic function and its derivative

def nonlin(self, x, deriv=False):
        if (deriv == True):
            return x * (1 - x)
        return 1 / (1 + np.exp(-x))

and it turns out that the derivative is x * (1 - x), but judging by Google, the derivative of the logistic function is df'(x) = f(x) * (1 - f(x)), and not df'(x)= x * (1 - x). However, when I correct the calculation of the derivative to the correct version in the code, the prediction accuracy of the neural network drops significantly.
Why?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
ivodopyanov, 2018-12-17
@Taras_Serevann

Because when calculating the derivative, the nonlin input is not the input of this layer, but the previously calculated output.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question