1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
| All_Patterns :
for Pattern in 1..Neuron.Train_length loop
NN_Train.Train;
NN_Train.Respond (Pattern, Response);
for I in Response'Range loop
Error := Error + (Desired_Output(Pattern)(i) - Response(i) );
end loop;
RMS_Error := RMS_Error + ((Error/Real(Response'Length)) ** 2);
Error := 0.0;
Response := (others => 0.0);
end loop All_Patterns;
RMS_Error := Real_Math.Sqrt(RMS_Error / Real (Neuron.Train_Length)) ;
if not Quiet then
Text_Io.Put("Epoch : ");
Text_Io.Put(Integer'Image(Epoch));
Text_Io.Put("RMS_Error : ");
Real_Io.Put(RMS_Error);
Text_Io.Put(Character'Val(13));
end if;
--if Epoch > 50 and then
if ((RMS_Error < Neuron.Converged) or
(Epoch > Neuron.Max_Epochs)) then
exit;
end if;
Epoch := Epoch + 1;
end loop; |
Partager