Skip to content Skip to sidebar Skip to footer

Multiple Objects Somehow Interfering With Each Other [original Version]

I have a neural network (NN) which works perfectly when applied to a single data set. However if I want to run the NN on, for example, one set of data and then create a new instanc

Solution 1:

Your error -- if there is one -- doesn't have anything to do with the class. As @Daniel Roseman suggested, the natural guess would be that it was a class/instance variable issue, or maybe a mutable default argument, or multiplication of a list, or something, the most common causes of mysterious behaviour.

Here, though, you're getting different results only because you're using different random numbers each time. If you random.seed(0) before you call NN(2,3,1), you get exactly the same results:

error2.68110error0.44049error0.39256error0.26315error0.00584
[ 0.010.010.070.97]
error2.68110error0.44049error0.39256error0.26315error0.00584
[ 0.010.010.070.97]

I can't judge whether your algorithm is right. Incidentally, I think your rand function is reinventing random.uniform.

Post a Comment for "Multiple Objects Somehow Interfering With Each Other [original Version]"