I'm not math savvy so this might be a stupid question - but is X * (1 - X) correct in this context? I'd expect something like sigm(X) * (1 - sigm(X))