Pm.step_methods() doesn't include pm.SMC() in pymc3 v 3.8

Hi all,

when I list the available sampling algorithms SMC is missing:
‘BinaryGibbsMetropolis’,
‘BinaryMetropolis’,
‘CategoricalGibbsMetropolis’,
‘CauchyProposal’,
‘CompoundStep’,
‘DEMetropolis’,
‘ElemwiseCategorical’,
‘EllipticalSlice’,
‘HamiltonianMC’,
‘LaplaceProposal’,
‘Metropolis’,
‘MultivariateNormalProposal’,
‘NUTS’,
‘NormalProposal’,
‘PoissonProposal’,
‘Slice’

I am sure this is a beginners error but I am just starting to settle in to pymc3.
I am on Ubuntu 18.04, Python 3.7, installed via pip+git, pymc 3.8.

Thanks!

Hi Ondrej!
I think we’ll need more details here: what are you trying to do exactly?

Hey, yes, I am trying to get a marginal likelihood estimate for a model and in the documentation (section Sequential Monte Carlo in https://docs.pymc.io/notebooks/Bayes_factor.html) mentions that this can be used using sequential sampling. Does that clarify things? If there is another way to get the evidence I’d also be keen to hear about that. Thanks!

1 Like

Sorry about the confusion. The documentation is behind the last changes. Check this https://github.com/pymc-devs/pymc3/blob/046744a91771aa09e1b662a054e1b5acf78e7e14/docs/source/notebooks/Bayes_factor.ipynb for a working example.

Notice that smc is no longer a step method and that the evidence is computed on the log-scale.

2 Likes

Thanks! And yes, log scale, noted.

I was having the same issue. I tried the updated example given by @aloctavodia and works fine. However, I realized that it seems that model does not have the attribute “marginal_log_likelihood” anymore. So, line In [8] in the example gives an error. I changed that line for something like:

BF_smc = np.exp(np.log(aux.marginal_likelihood) - np.log(models[0].marginal_likelihood))
print(round(BF_smc))

It does work now, but I’m not sure it’s the optimal way of doing it.

Hi @pymilo The version on master has the attribute marginal_log_likelihood previous to that the attribute’s name was marginal_likelihood, and you computed a BF as a ratio of marginal likelihoods.