Skip to content
This repository has been archived by the owner on May 12, 2019. It is now read-only.

Is there any guidance for custom sample space #172

Open
Roger-luo opened this issue Feb 11, 2018 · 2 comments
Open

Is there any guidance for custom sample space #172

Roger-luo opened this issue Feb 11, 2018 · 2 comments

Comments

@Roger-luo
Copy link

Hi guys, I would like to sample from a lattice configuration (some Array contains only 0 and 1), each sample looks like [0, 1, 0, 1, 1]. and I have a distribution function for it.

How can I tweak your sampler to accomplish this task?
Is there any guidance I could read?
Do I need to define a new variate type in Distributions.jl too?

@papamarkou
Copy link
Contributor

I understand your discrete parameter space is represented by an n-length vector (not matrix)? Do you have a proposal kernel for this, and if yes, in what form does it come, Is it a Markov transition matrix or a distribution conditional on the current state? Is the proposal symmetric or asymmetric?

@Roger-luo
Copy link
Author

@Scidom OK, this is a more detailed and more precise description:

About the sample space

The parameter space is an array (with arbitrary dimension) contains {0, 1} (sometimes {-1, 1} or {-0.5, 0.5}). Each metropolis step will flip some of them randomly (means flip the spin at n random positions)

a spin may looks like an array with tags

mutable struct Spin{T, N}
   up::T
   down::T
   data::Array{T, N}
end

the initialization is totally random, which can be done by this Julia command rand(shape, [up, down]). But the flip operation is different (which will be the proposal state in metropolis hasting).

About how to flip (generate a proposal for next step)

Generally, the next state will be generated based on previous state in metropolis, which means flip n spins in the array.

But how to flip it may different depends on the problem. And may have the following ways (So different type may need to be defined)

  1. use a uniform random offset to choose n positions to flip
  2. each you filp a spin (let's assume this spin is up) you need to find another spin randomly (which is down) and flip it to keep the total sum unchanged.
  3. etc.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants