File tree Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -85,7 +85,7 @@ def train_on_batch inputs, expected_outputs
85
85
86
86
def calculate_training_error ideal_output
87
87
@outputs [ output_layer ] . map . with_index do |output , i |
88
- ideal_output [ i ] - output
88
+ output - ideal_output [ i ]
89
89
end
90
90
end
91
91
@@ -142,7 +142,8 @@ def update_weights
142
142
weight = @weights [ layer ] [ neuron ] [ source_neuron ]
143
143
weight_change = @weight_changes [ layer ] [ neuron ] [ source_neuron ]
144
144
weight_update_value = @weight_update_values [ layer ] [ neuron ] [ source_neuron ]
145
- gradient = @gradients [ layer ] [ neuron ] [ source_neuron ]
145
+ # for RPROP, we use the negative of the calculated gradient
146
+ gradient = -@gradients [ layer ] [ neuron ] [ source_neuron ]
146
147
previous_gradient = @previous_gradients [ layer ] [ neuron ] [ source_neuron ]
147
148
148
149
c = sign ( gradient * previous_gradient )
You can’t perform that action at this time.
0 commit comments