A central task in several learning applications is the ability to sample from a given machine. For example, in the variational learning one samples quantum numbers from the probability distribution given by the square modulus of the wave-function:

NetKet implements several local Metropolis-Hastings moves. In this case, the sampler transits from the current set of quantum numbers to another set . Samplers are then fully specified by the transition probability:

The local samplers implemented in NetKet propose to modify only a limited set of quantum numbers at the time. Hamiltonian sampler instead use the off-diagonal elements of the Hamiltonian to construct the transition matrix. For more customized applications, arbitrary sampling strategies based on set of local operators can also be defined in NetKet. This is achieved specifying a set of local stochastic transition operators, as explained in Custom samplers.

Most samplers can also be used with parallel-tempering moves. In this case, one effectively samples from the a set of probability distributions

each associated to an inverse temperature . During the sampling, configurations at different temperatures are exchanged, to increase ergodicity. Only quantum numbers sampled from (corresponding to the original probability distribution) are retained to compute the required expectation values.

Inverse temperatures are chosen according to the simple form , where is a user-supplied number specifying how many temperatures are to be taken. Upon increasing the number of temperatures (or replicas, in the jargon) one can improve the sampling efficiency.

The samplers described below can be used for any quantum system with a local (and finite) discrete Hilbert space.