Cached Samples not abiding by the Metropolis Local Rule. #1685
-
Hey everyone, I am trying to use To perform this I am using For example when set the import os
os.environ["JAX_PLATFORM_NAME"]="cpu"
import netket as nk
import numpy as np
from netket.operator.spin import sigmax,sigmaz
import netket.experimental as nkx
import flax.linen as nn
import sys
from tqdm import tqdm
import jax
N=6 #sets number of spins
hilb=nk.hilbert.Spin(s=1/2,N=N) #builds the Hilbert Space
graph=nk.graph.Chain(length=N, pbc=True)
samples=10 #sets the number of samples used in the VMC
LR=0.05 #sets the learning rate for the SGD
alpha=1 #sets the hidden unit density
model=nk.models.RBMSymm(alpha=alpha,param_dtype=np.complex128,symmetries=graph.translation_group()) #creates symmetric RBM
sampler = nk.sampler.MetropolisLocal(hilb,n_chains=1) #initialises the monte carlo sampler
vs = nk.vqs.MCState(sampler, model, n_samples=samples,seed=1000) #creates the initial variational state
vs.init_parameters(nn.initializers.normal(stddev=0.01)) #initialises the parameters randomly
print(vs.samples) then the set of samples it returns is
which dont seem to abide by the metropolis local rule and this does happen with other seeds and when one isn't specified. Sorry if this is a very trivial question but is this a valid set of samples which do abide by the local rule or is there something I am misunderstaning with both the sampler or the variational state interface? Any help or advice would be greatly appreciated. Thank you! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hi do you mean that the printed samples do not differ by a single spin flips? If so this is because samples are taken every sweep_size steps, where by default sweep_size is the number of degrees of freedom. This means there can be as many as N bit flips between one printed sample and the next one |
Beta Was this translation helpful? Give feedback.
Hi do you mean that the printed samples do not differ by a single spin flips? If so this is because samples are taken every sweep_size steps, where by default sweep_size is the number of degrees of freedom. This means there can be as many as N bit flips between one printed sample and the next one