danijar / layered

Clean implementation of feed forward neural networks
MIT License
240 stars 33 forks source link

Question about Softmax delta function #30

Open howardyclo opened 8 years ago

howardyclo commented 8 years ago

Hello

First, thanks for your modular implementation for neural nets. It benefits me a lot for learning neural nets. Here is one question, when I was tracing your code in Softmax class implementation, I couldn't understand what does the code in delta function. It'll be nice if you can explain this, thanks! Are there references when you write this code ? Thanks.

    def delta(self, incoming, outgoing, above):
        delta = outgoing * above
        sum_ = delta.sum(axis=delta.ndim - 1, keepdims=True) # I don't understand this line
        delta -= outgoing * sum_ # I don't understand this line
        return delta