3
$\begingroup$

I'm required to be able to calculate the error on a given neuron in a neural network using Tensorflow.

Using this :

mse = tf.reduce_mean(tf.squared_difference(out, Y))
opt = tf.train.GradientDescentOptimizer(0.1).minimize(mse)

i just get the updated weight, how i can get or calculate the error for each neuron in my network.

Thanks for the replies.

$\endgroup$
1
  • $\begingroup$ To calculate error the true value is needed. Therefore you need the true value of each neuron in the network to calculate the error, which is probably not possible. $\endgroup$
    – kenny
    Aug 4, 2018 at 0:17

1 Answer 1

1
$\begingroup$

Easy, you have already done it.

mse = tf.reduce_mean(tf.squared_difference(out, Y))

This command means you are taking the mean of all the neurons over all the examples.

error = tf.squared_difference(out, Y)

This command will give you the error over all neurons over all examples. But make sure you calculate against the correct axes.

$\endgroup$
6
  • $\begingroup$ Can you explain more please,How to access to the neuron error ? $\endgroup$
    – lafi raed
    Jul 4, 2018 at 22:08
  • $\begingroup$ @lafiraed what exactly do you mean access? if you are looking to print it then print(error.eval()) inside a session should work fine $\endgroup$
    – DuttaA
    Jul 5, 2018 at 16:49
  • $\begingroup$ assume we have one hidden layer that have 20 neuron, i need to get the error for each neuron? $\endgroup$
    – lafi raed
    Jul 5, 2018 at 17:34
  • $\begingroup$ @lafiraed what? If you show me any equation or book that shows how to calculate errors for hidden layer then I'll tell you how to get it $\endgroup$
    – DuttaA
    Jul 5, 2018 at 17:39
  • $\begingroup$ no sorry i don't have it! $\endgroup$
    – lafi raed
    Jul 5, 2018 at 17:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.