  Recently machine learning using neural networks (NN) has been developed, and
many new methods have been suggested. These methods are optimized for the type
of input data and work very effectively, but they cannot be used with any kind
of input data universally. On the other hand, the human brain is universal for
any kind of problem, and we will be able to construct artificial general
intelligence if we can mimic the system of how the human brain works. We
consider how the human brain learns things uniformly, and find that the essence
of learning is the compression of information. We suggest a toy NN model which
mimics the system of the human brain, and we show that the NN can compress the
input information without ad hoc treatment, only by setting the loss function
properly. The loss function is expressed as the sum of the self-information to
remember and the loss of the information along with the compression, and its
minimum corresponds to the self-information of the original data. To evaluate
the self-information to remember, we provided the concept of memory. The memory
expresses the compressed information, and the learning proceeds by referring to
previous memories. There are many similarities between this NN and the human
brain, and this NN is a realization of the free-energy principle which is
considered to be a unified theory of the human brain. This work can be applied
to any kind of data analysis and cognitive science.
