implemented function for calculating activations
stochastic training improvements