CNTK icon indicating copy to clipboard operation
CNTK copied to clipboard

different value of SquareError

Open FreedMana opened this issue 10 years ago • 5 comments

I found that different versions of CNTK may get different values of SquareError . And the only difference is about the coefficient 1/2 . So the error information in different experiments can't keep the consistency. Why it changes ?

FreedMana avatar Jun 21 '16 09:06 FreedMana

I am not sure if this coefficient may have affected the back-propagated gradient. That could lead to different convergence.

Could you let us know the version you are using? There have also been some fixes regarding better reproducibility by avoiding atomicAdd() CUDA operations (which lead to non-deterministic order of summations, which in recurrent models have been found to confound and lead to notably different convergence, and a different result for a instable model).

frankseide avatar Jun 21 '16 15:06 frankseide

Sorry, I have already update the cntk to the latest version in all machines. Now it seems good. Thanks,frank.

FreedMana avatar Jun 22 '16 00:06 FreedMana

@frankseide

Hi, I have a question about the result of the SquareError function. I found the mse is different with the result I calculate by summing the square difference for each pixel in an image.

In the Deconvolution and Unpooling usage example in the Network number 4 in MNIST Sample, I test the trained network using only one sample and the results is: Minibatch[1-1]: mse = 90.63131714 * 1 Final Results: Minibatch[1-1]: mse = 90.63131714 * 1

In ndl file, mse = SquareError(featScaled, deconv1)

Then I output the featScaled, deconv1 and calculated the square error by myself. It is 78.536791. I tried several artificial data sets. The result images seem correct. But the mse is always a little bit higher. I am wondering if I can find the source code of SquareError() somewhere to check if I calculated incorrectly? Or the output deconv1 is not the final variable used for calculating mse ?

Thank you for your reply!

Pin

pinzhang10 avatar Jul 15 '16 00:07 pinzhang10

@pinzhang10

To the best of my knowledge, the source code is in TrainingNodes.h -> class SquareErrorNode -> ForwardPropNonLooping(). Hope that helps.

Best, Daniel

DanielMerget avatar Jul 15 '16 12:07 DanielMerget

@DanielMerget

Thank you very much for your reply! I debugged into the code. There are some other operations after the square error is calculated. That is the reason.

Thank you!

pinzhang10 avatar Jul 19 '16 14:07 pinzhang10