0b9e1f064ab1ce1d994f86686e7d662a46095e36,doc/source/notebooks/advanced/mcmc.pct.py,,,#,123

Before Change


// We now sample from the posterior using HMC.

// %%
parameters_dict = gpflow.utilities.select_dict_parameters_with_prior(model)
parameters = tuple(parameters_dict.values())
hmc_helper = gpflow.optimizers.SamplingHelper(model.log_marginal_likelihood, parameters)

hmc = tfp.mcmc.HamiltonianMonteCarlo(
    target_log_prob_fn=hmc_helper.target_log_prob_fn, num_leapfrog_steps=10, step_size=0.01
)
adaptive_hmc = tfp.mcmc.SimpleStepSizeAdaptation(
    hmc, num_adaptation_steps=10, target_accept_prob=f64(0.75), adaptation_rate=0.1
)

After Change



// %%
num_burnin_steps = ci_niter(300)
num_samples = ci_niter(500)

// Note that here we need model.trainable_parameters, not trainable_variables - only parameters can have priors!
hmc_helper = gpflow.optimizers.SamplingHelper(
    model.log_marginal_likelihood, model.trainable_parameters
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 16

Instances


Project Name: GPflow/GPflow
Commit Name: 0b9e1f064ab1ce1d994f86686e7d662a46095e36
Time: 2020-03-30
Author: st--@users.noreply.github.com
File Name: doc/source/notebooks/advanced/mcmc.pct.py
Class Name:
Method Name:


Project Name: GPflow/GPflow
Commit Name: 0b9e1f064ab1ce1d994f86686e7d662a46095e36
Time: 2020-03-30
Author: st--@users.noreply.github.com
File Name: doc/source/notebooks/advanced/mcmc.pct.py
Class Name:
Method Name:


Project Name: GPflow/GPflow
Commit Name: 0b9e1f064ab1ce1d994f86686e7d662a46095e36
Time: 2020-03-30
Author: st--@users.noreply.github.com
File Name: doc/source/notebooks/advanced/mcmc.pct.py
Class Name:
Method Name:


Project Name: GPflow/GPflow
Commit Name: 0b9e1f064ab1ce1d994f86686e7d662a46095e36
Time: 2020-03-30
Author: st--@users.noreply.github.com
File Name: doc/source/notebooks/advanced/mcmc.pct.py
Class Name:
Method Name: