  It was recently shown that the Madelung equations, that is, a hydrodynamic
form of the Schr\"odinger equation, can be derived from a canonical ensemble of
neural networks where the quantum phase was identified with the free energy of
hidden variables. We consider instead a grand canonical ensemble of neural
networks, by allowing an exchange of neurons with an auxiliary subsystem, to
show that the free energy must also be multivalued. By imposing the
multivaluedness condition on the free energy we derive the Schr\"odinger
equation with "Planck's constant" determined by the chemical potential of
hidden variables. This shows that quantum mechanics provides a correct
statistical description of the dynamics of the grand canonical ensemble of
neural networks at the learning equilibrium. We also discuss implications of
the results for machine learning, fundamental physics and, in a more
speculative way, evolutionary biology.
