#!/usr/bin/env python # coding: utf-8 # This notebook is a work in progress. # In[1]: from __future__ import division, print_function get_ipython().run_line_magic('matplotlib', 'inline') import numpy as np import matplotlib.pyplot as plt plt.style.use('ggplot') # In[2]: from qinfer.test_models import SimplePrecessionModel from qinfer.derived_models import RandomWalkModel from qinfer.distributions import NormalDistribution, UniformDistribution from qinfer.smc import SMCUpdater # In[3]: prior = UniformDistribution([0, 1]) step_dist = NormalDistribution(0, 0.01**2) # In[4]: model = RandomWalkModel(SimplePrecessionModel(), step_dist) # In[5]: updater = SMCUpdater(model, 1000, prior) # In[6]: experiments = np.logspace(-2, 4, 200) true_model = prior.sample() for idx_exp, experiment in enumerate(experiments): outcome = model.simulate_experiment(true_model, experiment[np.newaxis]) updater.update(outcome, experiment[np.newaxis]) print true_model, updater.est_mean() # In[ ]: