  The swift progression of machine learning (ML) has not gone unnoticed in the
realm of statistical mechanics. ML techniques have attracted attention by the
classical density-functional theory (DFT) community, as they enable discovery
of free-energy functionals to determine the equilibrium-density profile of a
many-particle system. Within DFT, the external potential accounts for the
interaction of the many-particle system with an external field, thus, affecting
the density distribution. In this context, we introduce a statistical-learning
framework to infer the external potential exerted on a many-particle system. We
combine a Bayesian inference approach with the classical DFT apparatus to
reconstruct the external potential, yielding a probabilistic description of the
external potential functional form with inherent uncertainty quantification.
Our framework is exemplified with a grand-canonical one-dimensional particle
ensemble with excluded volume interactions in a confined geometry. The required
training dataset is generated using a Monte Carlo (MC) simulation where the
external potential is applied to the grand-canonical ensemble. The resulting
particle coordinates from the MC simulation are fed into the learning framework
to uncover the external potential. This eventually allows us to compute the
equilibrium density profile of the system by using the tools of DFT. Our
approach benchmarks the inferred density against the exact one calculated
through the DFT formulation with the true external potential. The proposed
Bayesian procedure accurately infers the external potential and the density
profile. We also highlight the external-potential uncertainty quantification
conditioned on the amount of available simulated data. The seemingly simple
case study introduced in this work might serve as a prototype for studying a
wide variety of applications, including adsorption and capillarity.
