We explore the perspectives of machine learning techniques in the context of quantum field theories. In particular, we discuss two-dimensional complex scalar field theory at nonzero temperature and chemical potential – a theory with a nontrivial phase diagram. A neural network is successfully trained to recognize the different phases of this system and to predict the value of various observables, based on the field configurations. We analyze a broad range of chemical potentials and find that the network is robust and able to recognize patterns far away from the point where it was trained. Aside from the regressive analysis, which belongs to supervised learning, an unsupervised generative network is proposed to produce new quantum field configurations that follow a specific
distribution. An implicit local constraint fulfilled by the physical configurations was found to be automatically captured by our generative model. We elaborate on potential uses of such a generative approach for sampling outside the training region.