Algorithm predicts neural electrical activity during shock therapy