sample_model_dep_mcmc
- pyoptex.analysis.estimators.sams.models.model.sample_model_dep_mcmc(dep, size, n_samples=1, forced=None, mode=None, skip=10, n_warmup=1000)[source]
Sample a model given the dependency matrix of a fixed size. The terms are sampled using Markov-chain Monte-carlo.
First a random model is sampled by adding terms one-by-one. Next, that sample is mutated for n_warmup times. Finally, a chain is built by mutating the sample and extracting every skip th sample until n_samples are generated.
This is exactly the same method SAMS uses to sample and mutate the models, except for the fact that no acceptance probability is used and every skip samples are skipped.
Parameters
- depnp.array(2d)
The dependency matrix of size (N, N) with N the number of terms in the encoded model (output from Y2X). Term i depends on term j if dep(i, j) = true.
- sizeint
The size of the model to sample.
- n_samplesint
The number of samples to draw.
- forcednp.array(1d)
A model which must be included at all times.
- modeNone or ‘weak’ or ‘strong’
The heredity mode during sampling.
- skipint
Take every skip th sample from the Markov-chain.
- n_warmupint
The number of warmup mutations for a random initial model.
Returns
- modelnp.array(2d)
The sampled model which is an array of integers of size (n_samples, size).