General Stochastic Networks for Classification