Stacked Auto-encoder cost function