davharris / mistnet

stochastic neural networks in R
24 stars 3 forks source link

Gibbs sampling for MRFs #67

Open davharris opened 10 years ago

davharris commented 10 years ago

Partly implemented in the simulation script that makes fakedata

davharris commented 9 years ago

Example code:

# Gibbs sampling.  Update one species (column) at a time, conditional 
# on everyone else.
for(i in 1:iter){
  for(j in 1:n.species){
    state[ , j] = rbinom(
      n.sites,
      prob = sigmoid(inputs[, j] + state %*% lateral[, j]),
      size = 1
    )
  }
}