// Computes the delta for the previous layer's node in the network given each input
// weight. Along with the deltas computed in the current layer.
Computes the delta for the previous layer's node in the network given each input
weight. Along with the deltas computed in the current layer.
// Computes the delta for the previous layer ' s node in the network given each input // weight . Along with the deltas computed in the current layer .
func computeDeltas(layer *Layer, deltasPrev, deltas []float64) {
	log.Println("computeDeltas")
	for h, input := range layer.Inputs {
		sum := 0.0
		for k, node := range layer.Nodes {
			sum += node.Weights[h] * deltas[k]
		}
		log.Println("computeDeltas", h, len(layer.Inputs), len(layer.Nodes), len(deltasPrev), len(deltas))
		deltasPrev[h] = input * (1 - input) * sum
	}
}
func computeDeltas ( layer * Layer , deltasPrev , deltas [ ] float64 ) { log . Println ( " " ) for h , input := range layer . Inputs { sum := 0.0 for k , node := range layer . Nodes { sum += node . Weights [ h ] * deltas [ k ] } log . Println ( " " , h , len ( layer . Inputs ) , len ( layer . Nodes ) , len ( deltasPrev ) , len ( deltas ) ) deltasPrev [ h ] = input * ( 1 - input ) * sum } }
Computes the delta for the previous layer's node in the network given each input
weight.
Computes the delta for the previous layer ' s node in the network given each input weight .
// For each input h compute $$o_h (1 - o_h) \sum_{k \in nodes} w_{kh} \delta_{k}$$ // Used instead so we can compute the deltas on the node with the inputs instead of // the node the inputs were outputs of. // Same as: for each node h compute $$o_h (1 - o_h) \sum_{k \in outputs} w_{kh} \delta_{k}$$