This sampler acts locally only on one local degree of freedom , and proposes a new state: , where .
The transition probability associated to this sampler can be decomposed into two steps:
- One of the site indices is chosen with uniform probability.
- Among all the possible () values that can take, one of them is chosen with uniform probability.
For example, in the case of spin particles,
and the possible local values are .
In this case then
MetropolisLocal is equivalent to flipping a random spin.
In the case of bosons, with occupation numbers
would pick a random local occupation number uniformly between
Constructs a new
MetropolisLocal sampler given a machine.
|machine||netket.machine.Machine||A machine used for the sampling. The probability distribution being sampled from is .|
Sampling from a RBM machine in a 1D lattice of spin 1/2
>>> import netket as nk >>> >>> g=nk.graph.Hypercube(length=10,n_dim=2,pbc=True) >>> hi=nk.hilbert.Spin(s=0.5,graph=g) >>> >>> # RBM Spin Machine >>> ma = nk.machine.RbmSpin(alpha=1, hilbert=hi) >>> >>> # Construct a MetropolisLocal Sampler >>> sa = nk.sampler.MetropolisLocal(machine=ma) >>> print(sa.hilbert.size) 100
Resets the state of the sampler, including the acceptance rate statistics and optionally initializing at random the visible units being sampled.
Seeds the random number generator used by the
|base_seed||int||The base seed for the random number generator|
Performs a sampling sweep. Typically a single sweep consists of an extensive number of local moves.
|acceptance||numpy.array||The measured acceptance rate for the sampling. In the case of rejection-free sampling this is always equal to 1.|
|hilbert||netket.hilbert||The Hilbert space used for the sampling.|
|machine||netket.machine||The machine used for the sampling.|
|visible||numpy.array||The quantum numbers being sampled, and distributed according to|