Looking at the code, I'm somewhat confused on some key points. Specifically, we need to run the method twice, once to train and once to test. However, it seems that for this five fold validation that isn't the correct construction: we want to run the code once and have it select five random groups, and for each random group run "train" on the four other groups then "test" on the fifth group (i.e. pull one group aside, build the network with everything else, then test on the group we pulled aside, then repeats for each other group). I'm not sure this fixes the problem on hand, but it is something to be aware of.
I think having a constant, small, positive scaling factor should also help. I've been trying to parse through the code as well but I'm having trouble seeing anything critically wrong. Unfortunately, I'm also too tired to continue tonight. I'll meet up with you guys around noon tomorrow and hopefully we can get this working.
Tom