// Updates the weights of each layer based on the deltas already computed.
Updates the weights of each layer based on the deltas already computed.
// Updates the weights of each layer based on the deltas already computed .
func updateWeights(layer *Layer, deltas, prevDeltas []float64, learnRate, momentum float64) {
	log.Println("updateWeights")
	for i, input := range layer.Inputs {
		for j, node := range layer.Nodes {
			delta := learnRate*deltas[j]*input + momentum*prevDeltas[j]
			log.Println("updateWeights", i, j, len(layer.Inputs), len(layer.Nodes), len(deltas), delta)
			node.Weights[i] += delta
		}
	}
}
func updateWeights ( layer * Layer , deltas , prevDeltas [ ] float64 , learnRate , momentum float64 ) { log . Println ( " " ) for i , input := range layer . Inputs { for j , node := range layer . Nodes { delta := learnRate * deltas [ j ] * input + momentum * prevDeltas [ j ] log . Println ( " " , i , j , len ( layer . Inputs ) , len ( layer . Nodes ) , len ( deltas ) , delta ) node . Weights [ i ] += delta } } }
Updates the weights of each layer based on the deltas already computed.
Updates the weights of each layer based on the deltas already computed .
// For each input i update each of its weights for node j. // $$w_{ij}(n) \leftarrow w_{ij} + \eta \delta_j x_{ij} + \alpha w_{ij}(n-1)$$