In this paper, we study pattern recognition using stochastic artificial neural networks (SANN). A learning system can be defined by three rules: the encoding rule, the rule of internal change, and the quantization rule. In our system, the data encoding is to store an image in a stable distribution of a SANN. Given an input image f (epsilon) F, one can find a SANN t (epsilon) T such that the equilibrium distribution of this SANN is the given image f. Therefore, the input image, f, is encoded into a specification of a SANN, t. This mapping from F (image space) to T (parameter space of SANN) defines SANN transformation. SANN transformation encodes an input image into a relatively small vector which catches the characteristics of the input vector. The internal space T is the parameter space of SANN. The internal change rule of our system uses a local minima algorithm to encode the input data. The output data of the encoding stage is a specification of a stochastic dynamical system. The quantization rule divides the internal data space T by sample data.