Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

192
Views
¿Por qué la implementación de mi red neuronal personalizada está atascada en un costo de 0,25?

Creé una biblioteca de redes neuronales personalizada que se atasca con una pérdida de 0,25. La red es una red 2-2-1, lo que significa que tiene dos entradas, una capa oculta de tamaño dos y una salida. Lo estoy entrenando en un conjunto de datos XOR. (exclusivo o)
LO QUE YO SÉ:
Esta implementación funciona con una sola capa.
Esto me lleva a creer que el error está en alguna parte de mi código donde encuentro la derivada de la activación en capas anteriores a la función de costo, porque cuando solo hay dos capas no es necesario hacer eso, y si lo haces no importa.

El pseudocódigo de back-prop de un solo ejemplo de entrenamiento:

 forward(inputs) for each neuron in last layer: neuron.cost = neuron.activation - neuron.expected_output #this is getting the cost for each neuron for each layer except the last one(i): for each neuron in layer(j): for each neuron in layer+1(h): #this is where i calc the deriv of each weight layer.weight[(the one connecting J and H)].deriv += layer.activations[j] * (layer+1.actFuncPrime(layerNext.z[h]) * 2 * layerNext.costs[h]); # "z" is the weighted sum before activation function is applied layer.neurons[j].cost += layer.weights[(the one connecting J and H)] * (layer+1.actFuncPrime(layerNext.z[h]) * 2 * layerNext.costs[h]); #also i calculate the bias sensitivities but I dont think it needs to be shows here.

El verdadero código javascript:
 this.forward(input); for (var i = 0; i < this.layers[this.layers.length - 1].size; i++) { let layer = this.layers[this.layers.length - 1]; layer.costs[i] = layer.activations[i] - expectedOut[i]; //we will power^2 at the end. } for (i = this.layers.length - 2; i >= 0; i--) { let layer = this.layers[i]; let layerNext = this.layers[i + 1]; for (var j = 0; j < layer.size; j++) { for (var h = 0; h < layerNext.size; h++) { layer.ws[h + j * layerNext.size] += layer.activations[j] * (layerNext.actFuncPrime(layerNext.z[h]) * 2 * layerNext.costs[h]); layer.costs[j] += layer.w[h + j * layerNext.size] * (layerNext.actFuncPrime(layerNext.z[h]) * 2 * layerNext.costs[h]);//error here maybe? } } for (h = 0; h < layerNext.size; h++) { layerNext.bs[h] += layerNext.actFuncPrime(layerNext.z[h]) * 2 * layerNext.costs[h]; } }

Para actualizar los pesos y sesgos, simplemente los agrego a sus respectivas graduaciones negativas * 0.001 (tasa de aprendizaje).

Después de entrenar:
Solo genera ~ 0.5 sin importar lo que ingrese, lo que le da una pérdida de aproximadamente 0.25 ...

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Me estaba olvidando de restablecer los costos de cada neurona antes de cada época. Esto estaba haciendo que los costos se sumaran.

Yo añadí:

 layer.costs[j] = 0;

antes de esta línea:

 layer.costs[j] +=....;
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!