public static void prtPesos1(RedNeuronal rn) { Console.WriteLine("########################## PESOS 1 ##########################"); for (int i = 0; i < 20; i++) { for (int j = 0; j < 35; j++) { Console.WriteLine("Peso 1 " + j + " " + i + ": " + rn.getPesosE()[j, i]); } } }
public static void ajustarPesosBP(RedNeuronal rn, double error, int neuSalida) { double[] oculta = rn.getOculta(); int tamaño_oculta = oculta.Length; double[] WD = new double[tamaño_oculta]; double[] SOD = new double[tamaño_oculta]; double[] PesosDWD = new double[rn.getPesosE().Length]; double[] entrada = (double[])rn.getEntrada().Clone(); double[,] PreChanges = (double[, ])rn.getPesosSCopia().Clone(); double[] ocultaSP = rn.getOcultaSP(); for (int i = 0; i < WD.Length; i++) { WD[i] = oculta[i] * error; } double[,] pesos2 = rn.getPesosS(); for (int i = 0; i < WD.Length; i++) { pesos2[i, neuSalida] = WD[i]; } double pesoPrimerCapa = 0; for (int i = 0; i < WD.Length; i++) { pesoPrimerCapa = PreChanges[i, neuSalida] * error; pesoPrimerCapa *= ocultaSP[i]; SOD[i] = pesoPrimerCapa; } for (int i = 0; i < oculta.Length; i++) { for (int j = 0; j < entrada.Length; j++) { rn.pesosE[j, i] += SOD[i] * entrada[i]; } } }