The sign of the previous step current may be wrong at test time #100
Description
This could be quite a major bug that could explain a lot.
The main equation that Cap = q(v_now, I_now, N_now) - q(v_prev, I_prev, N_prev)
does hold.
However, previously, we were capturing the impedance effects ourselves, which meant that q(v, I, N) = q(v, -I, N)
In this "blackbox" model, this impedance effect is implicit within q. which means that q(v, I, N) is definitely not equal to q(v, -I, N).
Before, we didn't have to worry about feeding the right polarity into q, but now we do.
More specifically, in a typical cycle group, we have the currents given as absolute values. (I_end, I_constant, I_prev)
At train time, we need to check that the discharge steps give I_end with a negative sign, I_constant with a negative sign, and I_prev with a positive sign. Similarly, we need to check that charge steps give I_end with a positive sign, I_constant with a positive sign, and I_prev as a negative.
The same thing must be verified at test time. we must verify this, since it could cause strange behaviours around Cap == 0, which we observe to some extent with the simple fourfeat nets.