Probabilistic symmetry and invariant neural networks