2.2. Linear Bivariate BMM with SAMBA toy models : cdf mixing#
The best way to learn Taweret is to use it. You can run, modify and experiment with this notebook on GitHub Codespaces.
This notebook shows how to use the Bayesian model mixing package Taweret for a toy problem.
Author : Dan Liyanage
Date : 11/10/2022
More about SAMBA toy models can be found in Uncertainties here, there, and everywhere: interpolating between small- and large-g expansions using Bayesian Model Mixing
import sys
import os
# You will have to change the following imports depending on where you have
# the packages installed
# ! pip install Taweret # if using Colab, uncomment to install
cwd = os.getcwd()
# Get the first part of this path and append to the sys.path
tw_path = cwd.split("Taweret/")[0] + "Taweret"
samba_path = tw_path + "/subpackages/SAMBA"
sys.path.append(tw_path)
sys.path.append(samba_path)
# For plotting
import matplotlib.pyplot as plt
! pip install seaborn # comment if installed
! pip install ptemcee # comment if installed
import seaborn as sns
sns.set_context('poster')
# To define priors. (uncoment if not using default priors)
# ! pip install bilby # uncomment this line if bilby is not already installed
import bilby
# For other operations
import numpy as np
Requirement already satisfied: seaborn in /home/runner/work/Taweret/Taweret/.tox/book/lib/python3.12/site-packages (0.13.2)
Requirement already satisfied: numpy!=1.24.0,>=1.20 in /home/runner/work/Taweret/Taweret/.tox/book/lib/python3.12/site-packages (from seaborn) (2.4.3)
Requirement already satisfied: pandas>=1.2 in /home/runner/work/Taweret/Taweret/.tox/book/lib/python3.12/site-packages (from seaborn) (3.0.1)
Requirement already satisfied: matplotlib!=3.6.1,>=3.4 in /home/runner/work/Taweret/Taweret/.tox/book/lib/python3.12/site-packages (from seaborn) (3.10.8)
Requirement already satisfied: contourpy>=1.0.1 in /home/runner/work/Taweret/Taweret/.tox/book/lib/python3.12/site-packages (from matplotlib!=3.6.1,>=3.4->seaborn) (1.3.3)
Requirement already satisfied: cycler>=0.10 in /home/runner/work/Taweret/Taweret/.tox/book/lib/python3.12/site-packages (from matplotlib!=3.6.1,>=3.4->seaborn) (0.12.1)
Requirement already satisfied: fonttools>=4.22.0 in /home/runner/work/Taweret/Taweret/.tox/book/lib/python3.12/site-packages (from matplotlib!=3.6.1,>=3.4->seaborn) (4.62.0)
Requirement already satisfied: kiwisolver>=1.3.1 in /home/runner/work/Taweret/Taweret/.tox/book/lib/python3.12/site-packages (from matplotlib!=3.6.1,>=3.4->seaborn) (1.5.0)
Requirement already satisfied: packaging>=20.0 in /home/runner/work/Taweret/Taweret/.tox/book/lib/python3.12/site-packages (from matplotlib!=3.6.1,>=3.4->seaborn) (26.0)
Requirement already satisfied: pillow>=8 in /home/runner/work/Taweret/Taweret/.tox/book/lib/python3.12/site-packages (from matplotlib!=3.6.1,>=3.4->seaborn) (12.1.1)
Requirement already satisfied: pyparsing>=3 in /home/runner/work/Taweret/Taweret/.tox/book/lib/python3.12/site-packages (from matplotlib!=3.6.1,>=3.4->seaborn) (3.3.2)
Requirement already satisfied: python-dateutil>=2.7 in /home/runner/work/Taweret/Taweret/.tox/book/lib/python3.12/site-packages (from matplotlib!=3.6.1,>=3.4->seaborn) (2.9.0.post0)
Requirement already satisfied: six>=1.5 in /home/runner/work/Taweret/Taweret/.tox/book/lib/python3.12/site-packages (from python-dateutil>=2.7->matplotlib!=3.6.1,>=3.4->seaborn) (1.17.0)
Requirement already satisfied: ptemcee in /home/runner/work/Taweret/Taweret/.tox/book/lib/python3.12/site-packages (1.0.0)
Requirement already satisfied: numpy in /home/runner/work/Taweret/Taweret/.tox/book/lib/python3.12/site-packages (from ptemcee) (2.4.3)
2.2.1. 1. Get toy models and the pseudo-experimental data#
# Toy models from SAMBA
from Taweret.models import samba_models as toy_models
m1 = toy_models.Loworder(2, 'uninformative')
m2 = toy_models.Highorder(2, 'uninformative')
truth = toy_models.TrueModel()
exp = toy_models.Data()
g = np.linspace(0.1, 0.6, 10)
plot_g = np.linspace(0.01,1,100)
m1_prediction = m1.evaluate(plot_g)
m2_prediction = m2.evaluate(plot_g)
true_output = truth.evaluate(plot_g)
exp_data= exp.evaluate(g,error = 0.01)
fig, ax_f = plt.subplots(figsize=(10,10))
ax_f.plot(plot_g, m1_prediction[0].flatten(), label='low order')
ax_f.plot(plot_g, m2_prediction[0].flatten(), label='high order')
ax_f.plot(plot_g, true_output[0], label='truth')
ax_f.scatter(g,exp_data[0], marker='x', label='experimental data')
ax_f.set_ylim(1.2,3.2)
ax_f.legend()
<matplotlib.legend.Legend at 0x7f0328b8f3b0>
2.2.2. 2. Choose a Mixing method#
# Mixing method
from Taweret.mix.bivariate_linear import BivariateLinear as BL
models= {'low_order':m1,'high_order':m2}
mix_model = BL(models_dic=models, method='cdf')
cdf mixing function has 2 free parameter(s)
Warning : Default prior is set to {'cdf_0': Uniform(minimum=0, maximum=1, name='cdf_0', latex_label='cdf_0', unit=None, boundary=None), 'cdf_1': Uniform(minimum=0, maximum=1, name='cdf_1', latex_label='cdf_1', unit=None, boundary=None)}
To change the prior use `set_prior` method
/home/runner/work/Taweret/Taweret/.tox/book/lib/python3.12/site-packages/bilby/core/likelihood.py:83: FutureWarning: <class 'Taweret.sampler.likelihood_wrappers.likelihood_wrapper_for_bilby'> log_likelihood or log_likelihood_ratio method does not accept 'parameters' as an argument. This is deprecated behaviour and will be removed in Bilby version 3. See https://bilby-dev.github.io/bilby/parameters for more details.
warnings.warn(
#uncoment to change the prior from the default
priors = bilby.core.prior.PriorDict()
priors['cdf_0'] = bilby.core.prior.Uniform(-20,20, name="cdf_0")
priors['cdf_1'] = bilby.core.prior.Uniform(-20,20, name="cdf_1")
mix_model.set_prior(priors)
{'cdf_0': Uniform(minimum=-20, maximum=20, name='cdf_0', latex_label='cdf_0', unit=None, boundary=None),
'cdf_1': Uniform(minimum=-20, maximum=20, name='cdf_1', latex_label='cdf_1', unit=None, boundary=None)}
2.2.3. 3. Train to find posterior#
mix_model.prior
{'cdf_0': Uniform(minimum=-20, maximum=20, name='cdf_0', latex_label='cdf_0', unit=None, boundary=None),
'cdf_1': Uniform(minimum=-20, maximum=20, name='cdf_1', latex_label='cdf_1', unit=None, boundary=None)}
y_exp = np.array(exp_data[0]).reshape(1,-1)
y_err = np.array(exp_data[1]).reshape(1,-1)
# The parameters are set to minimum values for computational ease.
# You should increase the ntemps, nwalkers and nsamples and see
# if your results are changing. If so keep increasing them
# until convergence of results.
kwargs_for_sampler = {'sampler': 'ptemcee',
'ntemps': 5,
'nwalkers': 50,
'Tmax': 100,
'burn_in_fixed_discard': 50,
'nsamples': 2000,
'threads': 6}
result = mix_model.train(x_exp=g, y_exp=y_exp, y_err=y_err, outdir = 'outdir/samba_bivariate',
label='cdf_mix', kwargs_for_sampler=kwargs_for_sampler)
/home/runner/work/Taweret/Taweret/.tox/book/lib/python3.12/site-packages/bilby/core/likelihood.py:127: FutureWarning: Setting non-trivial parameters for <class 'Taweret.sampler.likelihood_wrappers.likelihood_wrapper_for_bilby'>. This is deprecated behaviour and will be removed in Bilby version 3. See https://bilby-dev.github.io/bilby/parameters for more details.
warnings.warn(msg, FutureWarning)
19:59 bilby INFO : Running for label 'cdf_mix', output will be saved to 'outdir/samba_bivariate'
The following settings were provided for sampler
{'sampler': 'ptemcee', 'ntemps': 5, 'nwalkers': 50, 'Tmax': 100, 'burn_in_fixed_discard': 50, 'nsamples': 2000, 'threads': 6}
/home/runner/work/Taweret/Taweret/.tox/book/lib/python3.12/site-packages/bilby/core/sampler/ptemcee.py:134: FutureWarning: The ptemcee sampler interface in bilby is deprecated and will be removed in Bilby version 3. Please use the `ptemcee-bilby`sampler plugin instead: https://github.com/bilby-dev/ptemcee-bilby.
warnings.warn(msg, FutureWarning)
19:59 bilby INFO : Analysis priors:
19:59 bilby INFO : cdf_0=Uniform(minimum=-20, maximum=20, name='cdf_0', latex_label='cdf_0', unit=None, boundary=None)
19:59 bilby INFO : cdf_1=Uniform(minimum=-20, maximum=20, name='cdf_1', latex_label='cdf_1', unit=None, boundary=None)
19:59 bilby INFO : Analysis likelihood class: <class 'Taweret.sampler.likelihood_wrappers.likelihood_wrapper_for_bilby'>
19:59 bilby INFO : Analysis likelihood noise evidence: nan
/home/runner/work/Taweret/Taweret/.tox/book/lib/python3.12/site-packages/bilby/core/likelihood.py:64: DeprecationWarning: Using parameters as state for likelihood_wrapper_for_bilby. This is deprecated behaviour and will be removed in Bilby version 3. See https://bilby-dev.github.io/bilby/parameters for more details.
warnings.warn(
/home/runner/work/Taweret/Taweret/.tox/book/lib/python3.12/site-packages/bilby/core/likelihood.py:113: FutureWarning: Parameter attribute queried for <class 'Taweret.sampler.likelihood_wrappers.likelihood_wrapper_for_bilby'>. This is deprecated behaviour and will be removed in Bilby version 3. See https://bilby-dev.github.io/bilby/parameters for more details.
warnings.warn(msg, FutureWarning)
19:59 bilby INFO : Single likelihood evaluation took 4.579e-04 s
19:59 bilby INFO : Using sampler Ptemcee with kwargs {'ntemps': 5, 'nwalkers': 50, 'Tmax': 100, 'betas': None, 'a': 2.0, 'adaptation_lag': 10000, 'adaptation_time': 100, 'random': None, 'adapt': False, 'swap_ratios': False}
19:59 bilby INFO : Global meta data was removed from the result object for compatibility. Use the `BILBY_INCLUDE_GLOBAL_METADATA` environment variable to include it. This behaviour will be removed in a future release. For more details see: https://bilby-dev.github.io/bilby/faq.html#global-meta-data
19:59 bilby INFO : Using convergence inputs: ConvergenceInputs(autocorr_c=5, autocorr_tol=50, autocorr_tau=1, gradient_tau=0.1, gradient_mean_log_posterior=0.1, Q_tol=1.02, safety=1, burn_in_nact=50, burn_in_fixed_discard=50, mean_logl_frac=0.01, thin_by_nact=0.5, nsamples=2000, ignore_keys_for_tau=None, min_tau=1, niterations_per_check=5)
19:59 bilby INFO : Generating pos0 samples
19:59 bilby INFO : Starting to sample
1|0:00:00|nc:1.2e+03|a0:0.20-1.00|swp:0.42-0.96|n:nan<2000|t!nan(+nan,+nan)|q:inf|0.23ms/ev
2|0:00:00|nc:2.5e+03|a0:0.30-0.90|swp:0.27-0.97|n:nan<2000|t!nan(+nan,+nan)|q:inf|0.29ms/ev
3|0:00:01|nc:3.8e+03|a0:0.27-0.93|swp:0.22-0.97|n:nan<2000|t!nan(+nan,+nan)|q:inf|0.27ms/ev
4|0:00:01|nc:5.0e+03|a0:0.30-0.85|swp:0.22-0.97|n:nan<2000|t!nan(+nan,+nan)|q:inf|0.27ms/ev
5|0:00:01|nc:6.2e+03|a0:0.28-0.80|swp:0.22-0.96|n:nan<2000|t!nan(+nan,+nan)|q:inf|0.23ms/ev
6|0:00:01|nc:7.5e+03|a0:0.33-0.80|swp:0.23-0.96|n:nan<2000|t!nan(+nan,+nan)|q:inf|0.23ms/ev
7|0:00:02|nc:8.8e+03|a0:0.31-0.83|swp:0.24-0.96|n:nan<2000|t!nan(+nan,+nan)|q:inf|0.23ms/ev
8|0:00:02|nc:1.0e+04|a0:0.35-0.80|swp:0.26-0.96|n:nan<2000|t!nan(+nan,+nan)|q:inf|0.23ms/ev
9|0:00:02|nc:1.1e+04|a0:0.40-0.82|swp:0.28-0.96|n:nan<2000|t!nan(+nan,+nan)|q:inf|0.23ms/ev
10|0:00:03|nc:1.2e+04|a0:0.42-0.84|swp:0.29-0.96|n:nan<2000|t!nan(+nan,+nan)|q:inf|0.23ms/ev
11|0:00:03|nc:1.4e+04|a0:0.44-0.80|swp:0.31-0.96|n:nan<2000|t!nan(+nan,+nan)|q:inf|0.23ms/ev
12|0:00:03|nc:1.5e+04|a0:0.48-0.82|swp:0.32-0.96|n:nan<2000|t!nan(+nan,+nan)|q:inf|0.23ms/ev
13|0:00:03|nc:1.6e+04|a0:0.48-0.80|swp:0.33-0.96|n:nan<2000|t!nan(+nan,+nan)|q:inf|0.23ms/ev
14|0:00:04|nc:1.8e+04|a0:0.50-0.77|swp:0.34-0.96|n:nan<2000|t!nan(+nan,+nan)|q:inf|0.23ms/ev
15|0:00:04|nc:1.9e+04|a0:0.51-0.76|swp:0.35-0.96|n:nan<2000|t!nan(+nan,+nan)|q:inf|0.23ms/ev
16|0:00:04|nc:2.0e+04|a0:0.51-0.75|swp:0.36-0.96|n:nan<2000|t!nan(+nan,+nan)|q:inf|0.23ms/ev
17|0:00:05|nc:2.1e+04|a0:0.53-0.75|swp:0.36-0.96|n:nan<2000|t!nan(+nan,+nan)|q:inf|0.23ms/ev
18|0:00:05|nc:2.2e+04|a0:0.52-0.74|swp:0.37-0.96|n:nan<2000|t!nan(+nan,+nan)|q:inf|0.23ms/ev
19|0:00:05|nc:2.4e+04|a0:0.52-0.75|swp:0.38-0.96|n:nan<2000|t!nan(+nan,+nan)|q:inf|0.23ms/ev
20|0:00:05|nc:2.5e+04|a0:0.54-0.74|swp:0.38-0.96|n:nan<2000|t!nan(+nan,+nan)|q:inf|0.23ms/ev
21|0:00:06|nc:2.6e+04|a0:0.53-0.74|swp:0.38-0.96|n:nan<2000|t!nan(+nan,+nan)|q:inf|0.23ms/ev
22|0:00:06|nc:2.8e+04|a0:0.54-0.74|swp:0.39-0.96|n:nan<2000|t!nan(+nan,+nan)|q:inf|0.23ms/ev
23|0:00:06|nc:2.9e+04|a0:0.55-0.74|swp:0.39-0.96|n:nan<2000|t!nan(+nan,+nan)|q:inf|0.23ms/ev
24|0:00:07|nc:3.0e+04|a0:0.54-0.74|swp:0.39-0.96|n:nan<2000|t!nan(+nan,+nan)|q:inf|0.24ms/ev
25|0:00:07|nc:3.1e+04|a0:0.54-0.73|swp:0.39-0.96|n:nan<2000|t!nan(+nan,+nan)|q:inf|0.24ms/ev
26|0:00:07|nc:3.2e+04|a0:0.54-0.74|swp:0.40-0.96|n:nan<2000|t!nan(+nan,+nan)|q:inf|0.24ms/ev
27|0:00:07|nc:3.4e+04|a0:0.54-0.75|swp:0.40-0.96|n:nan<2000|t!nan(+nan,+nan)|q:inf|0.23ms/ev
28|0:00:08|nc:3.5e+04|a0:0.54-0.74|swp:0.40-0.96|n:nan<2000|t!nan(+nan,+nan)|q:inf|0.23ms/ev
29|0:00:08|nc:3.6e+04|a0:0.55-0.72|swp:0.40-0.96|n:nan<2000|t!nan(+nan,+nan)|q:inf|0.23ms/ev
30|0:00:08|nc:3.8e+04|a0:0.55-0.72|swp:0.40-0.96|n:nan<2000|t!nan(+nan,+nan)|q:inf|0.23ms/ev
31|0:00:09|nc:3.9e+04|a0:0.55-0.73|swp:0.40-0.96|n:nan<2000|t!nan(+nan,+nan)|q:inf|0.23ms/ev
32|0:00:09|nc:4.0e+04|a0:0.55-0.73|swp:0.40-0.96|n:nan<2000|t!nan(+nan,+nan)|q:inf|0.24ms/ev
33|0:00:09|nc:4.1e+04|a0:0.55-0.73|swp:0.40-0.96|n:nan<2000|t!nan(+nan,+nan)|q:inf|0.24ms/ev
34|0:00:10|nc:4.2e+04|a0:0.55-0.72|swp:0.40-0.96|n:nan<2000|t!nan(+nan,+nan)|q:inf|0.24ms/ev
35|0:00:10|nc:4.4e+04|a0:0.55-0.71|swp:0.40-0.96|n:nan<2000|t!nan(+nan,+nan)|q:inf|0.24ms/ev
36|0:00:10|nc:4.5e+04|a0:0.55-0.71|swp:0.40-0.96|n:nan<2000|t!nan(+nan,+nan)|q:inf|0.23ms/ev
37|0:00:10|nc:4.6e+04|a0:0.55-0.71|swp:0.40-0.96|n:nan<2000|t!nan(+nan,+nan)|q:inf|0.23ms/ev
38|0:00:11|nc:4.8e+04|a0:0.54-0.72|swp:0.40-0.96|n:nan<2000|t!nan(+nan,+nan)|q:inf|0.23ms/ev
39|0:00:11|nc:4.9e+04|a0:0.55-0.72|swp:0.40-0.96|n:nan<2000|t!nan(+nan,+nan)|q:inf|0.23ms/ev
40|0:00:11|nc:5.0e+04|a0:0.56-0.72|swp:0.40-0.96|n:nan<2000|t!nan(+nan,+nan)|q:inf|0.23ms/ev
41|0:00:12|nc:5.1e+04|a0:0.57-0.73|swp:0.40-0.96|n:nan<2000|t!nan(+nan,+nan)|q:inf|0.23ms/ev
42|0:00:12|nc:5.2e+04|a0:0.57-0.73|swp:0.40-0.96|n:nan<2000|t!nan(+nan,+nan)|q:inf|0.23ms/ev
43|0:00:12|nc:5.4e+04|a0:0.56-0.72|swp:0.40-0.96|n:nan<2000|t!nan(+nan,+nan)|q:inf|0.24ms/ev
44|0:00:12|nc:5.5e+04|a0:0.56-0.72|swp:0.40-0.96|n:nan<2000|t!nan(+nan,+nan)|q:inf|0.24ms/ev
45|0:00:13|nc:5.6e+04|a0:0.55-0.72|swp:0.40-0.96|n:nan<2000|t!nan(+nan,+nan)|q:inf|0.24ms/ev
46|0:00:13|nc:5.8e+04|a0:0.55-0.72|swp:0.40-0.96|n:nan<2000|t!nan(+nan,+nan)|q:inf|0.23ms/ev
47|0:00:13|nc:5.9e+04|a0:0.54-0.73|swp:0.41-0.96|n:nan<2000|t!nan(+nan,+nan)|q:inf|0.23ms/ev
48|0:00:14|nc:6.0e+04|a0:0.54-0.72|swp:0.41-0.96|n:nan<2000|t!nan(+nan,+nan)|q:inf|0.24ms/ev
49|0:00:14|nc:6.1e+04|a0:0.54-0.72|swp:0.41-0.96|n:nan<2000|t!nan(+nan,+nan)|q:inf|0.24ms/ev
50|0:00:14|nc:6.2e+04|a0:0.54-0.71|swp:0.41-0.96|n:nan<2000|t!nan(+nan,+nan)|q:inf|0.23ms/ev
51|0:00:15|nc:6.4e+04|a0:0.55-0.71|swp:0.41-0.96|n:nan<2000|t!nan(+nan,+nan)|q:inf|0.23ms/ev
52|0:00:15|nc:6.5e+04|a0:0.55-0.71|swp:0.41-0.96|n:nan<2000|t!nan(+nan,+nan)|q:inf|0.24ms/ev
53|0:00:15|nc:6.6e+04|a0:0.55-0.71|swp:0.41-0.96|n:nan<2000|t!nan(+nan,+nan)|q:inf|0.24ms/ev
54|0:00:15|nc:6.8e+04|a0:0.55-0.70|swp:0.41-0.96|n:nan<2000|t!nan(+nan,+nan)|q:inf|0.24ms/ev
55|0:00:16|nc:6.9e+04|a0:0.55-0.71|swp:0.41-0.96|n:nan<2000|t!nan(+nan,+nan)|q:inf|0.24ms/ev
56|0:00:16|nc:7.0e+04|a0:0.55-0.71|swp:0.41-0.96|n:nan<2000|t!nan(+nan,+nan)|q:inf|0.24ms/ev
57|0:00:16|nc:7.1e+04|a0:0.56-0.71|swp:0.41-0.96|n:nan<2000|t!nan(+nan,+nan)|q:inf|0.24ms/ev
58|0:00:17|nc:7.2e+04|a0:0.56-0.71|swp:0.41-0.96|n:nan<2000|t!nan(+nan,+nan)|q:inf|0.24ms/ev
59|0:00:17|nc:7.4e+04|a0:0.56-0.71|swp:0.41-0.96|n:nan<2000|t!nan(+nan,+nan)|q:inf|0.24ms/ev
60|0:00:17|nc:7.5e+04|a0:0.56-0.71|swp:0.41-0.96|n:nan<2000|t!nan(+nan,+nan)|q:inf|0.24ms/ev
61|0:00:17|nc:7.6e+04|a0:0.56-0.71|swp:0.41-0.96|n:nan<2000|t!nan(+nan,+nan)|q:inf|0.24ms/ev
62|0:00:18|nc:7.8e+04|a0:0.57-0.71|swp:0.41-0.96|n:nan<2000|t!nan(+nan,+nan)|q:inf|0.23ms/ev
63|0:00:18|nc:7.9e+04|a0:0.57-0.70|swp:0.41-0.96|n:nan<2000|t!nan(+nan,+nan)|q:inf|0.23ms/ev
64|0:00:18|nc:8.0e+04|a0:0.57-0.70|swp:0.41-0.96|n:nan<2000|t!nan(+nan,+nan)|q:inf|0.23ms/ev
65|0:00:19|nc:8.1e+04|a0:0.57-0.70|swp:0.41-0.96|n:nan<2000|t!nan(+nan,+nan)|q:inf|0.23ms/ev
66|0:00:19|nc:8.2e+04|a0:0.58-0.70|swp:0.41-0.96|n:nan<2000|t!nan(+nan,+nan)|q:inf|0.23ms/ev
67|0:00:19|nc:8.4e+04|a0:0.58-0.70|swp:0.41-0.96|n:nan<2000|t!nan(+nan,+nan)|q:inf|0.23ms/ev
68|0:00:20|nc:8.5e+04|a0:0.58-0.70|swp:0.41-0.96|n:nan<2000|t!nan(+nan,+nan)|q:inf|0.23ms/ev
69|0:00:20|nc:8.6e+04|a0:0.58-0.70|swp:0.41-0.96|n:nan<2000|t!nan(+nan,+nan)|q:inf|0.24ms/ev
70|0:00:20|nc:8.8e+04|a0:0.58-0.70|swp:0.41-0.96|n:nan<2000|t!nan(+nan,+nan)|q:inf|0.24ms/ev
71|0:00:20|nc:8.9e+04|a0:0.58-0.70|swp:0.41-0.96|n:nan<2000|t!nan(+nan,+nan)|q:inf|0.24ms/ev
72|0:00:21|nc:9.0e+04|a0:0.58-0.70|swp:0.41-0.96|n:nan<2000|t!nan(+nan,+nan)|q:inf|0.23ms/ev
73|0:00:21|nc:9.1e+04|a0:0.58-0.70|swp:0.41-0.96|n:nan<2000|t!nan(+nan,+nan)|q:inf|0.23ms/ev
74|0:00:21|nc:9.2e+04|a0:0.58-0.71|swp:0.41-0.96|n:nan<2000|t!nan(+nan,+nan)|q:inf|0.23ms/ev
75|0:00:22|nc:9.4e+04|a0:0.58-0.70|swp:0.41-0.96|n:nan<2000|t!nan(+nan,+nan)|q:inf|0.23ms/ev
76|0:00:22|nc:9.5e+04|a0:0.58-0.71|swp:0.41-0.96|n:nan<2000|t!nan(+nan,+nan)|q:inf|0.23ms/ev
77|0:00:22|nc:9.6e+04|a0:0.58-0.71|swp:0.41-0.96|n:nan<2000|t!nan(+nan,+nan)|q:inf|0.23ms/ev
78|0:00:22|nc:9.8e+04|a0:0.58-0.71|swp:0.41-0.96|n:nan<2000|t!nan(+nan,+nan)|q:inf|0.23ms/ev
79|0:00:23|nc:9.9e+04|a0:0.58-0.71|swp:0.41-0.96|n:nan<2000|t!nan(+nan,+nan)|q:inf|0.23ms/ev
80|0:00:23|nc:1.0e+05|a0:0.58-0.71|swp:0.41-0.96|n:nan<2000|t!nan(+nan,+nan)|q:inf|0.24ms/ev
81|0:00:23|nc:1.0e+05|a0:0.58-0.71|swp:0.41-0.96|n:nan<2000|t!nan(+nan,+nan)|q:inf|0.24ms/ev
82|0:00:24|nc:1.0e+05|a0:0.58-0.71|swp:0.41-0.96|n:nan<2000|t!nan(+nan,+nan)|q:inf|0.24ms/ev
83|0:00:24|nc:1.0e+05|a0:0.58-0.71|swp:0.41-0.96|n:nan<2000|t!nan(+nan,+nan)|q:inf|0.23ms/ev
84|0:00:24|nc:1.0e+05|a0:0.58-0.72|swp:0.41-0.96|n:nan<2000|t!nan(+nan,+nan)|q:inf|0.23ms/ev
85|0:00:24|nc:1.1e+05|a0:0.58-0.72|swp:0.41-0.96|n:nan<2000|t!nan(+nan,+nan)|q:inf|0.23ms/ev
86|0:00:25|nc:1.1e+05|a0:0.58-0.71|swp:0.41-0.96|n:nan<2000|t!nan(+nan,+nan)|q:inf|0.23ms/ev
87|0:00:25|nc:1.1e+05|a0:0.58-0.72|swp:0.41-0.96|n:nan<2000|t!nan(+nan,+nan)|q:inf|0.23ms/ev
88|0:00:25|nc:1.1e+05|a0:0.58-0.72|swp:0.41-0.96|n:nan<2000|t!nan(+nan,+nan)|q:inf|0.23ms/ev
89|0:00:26|nc:1.1e+05|a0:0.58-0.71|swp:0.41-0.96|n:nan<2000|t!nan(+nan,+nan)|q:inf|0.23ms/ev
90|0:00:26|nc:1.1e+05|a0:0.58-0.71|swp:0.41-0.96|n:nan<2000|t!nan(+nan,+nan)|q:inf|0.23ms/ev
91|0:00:26|nc:1.1e+05|a0:0.58-0.71|swp:0.41-0.96|n:nan<2000|t!nan(+nan,+nan)|q:inf|0.23ms/ev
92|0:00:26|nc:1.2e+05|a0:0.58-0.71|swp:0.41-0.96|n:nan<2000|t!nan(+nan,+nan)|q:inf|0.24ms/ev
93|0:00:27|nc:1.2e+05|a0:0.58-0.71|swp:0.41-0.96|n:nan<2000|t!nan(+nan,+nan)|q:inf|0.23ms/ev
94|0:00:27|nc:1.2e+05|a0:0.58-0.71|swp:0.41-0.96|n:nan<2000|t!nan(+nan,+nan)|q:inf|0.23ms/ev
95|0:00:27|nc:1.2e+05|a0:0.58-0.71|swp:0.41-0.96|n:nan<2000|t!nan(+nan,+nan)|q:inf|0.23ms/ev
96|0:00:28|nc:1.2e+05|a0:0.58-0.70|swp:0.41-0.96|n:nan<2000|t!nan(+nan,+nan)|q:inf|0.23ms/ev
97|0:00:28|nc:1.2e+05|a0:0.58-0.70|swp:0.41-0.96|n:nan<2000|t!nan(+nan,+nan)|q:inf|0.23ms/ev
98|0:00:28|nc:1.2e+05|a0:0.58-0.70|swp:0.41-0.96|n:nan<2000|t!nan(+nan,+nan)|q:inf|0.23ms/ev
99|0:00:29|nc:1.2e+05|a0:0.58-0.70|swp:0.41-0.96|n:nan<2000|t!nan(+nan,+nan)|q:inf|0.23ms/ev
100|0:00:29|nc:1.2e+05|a0:0.58-0.70|swp:0.41-0.96|n:nan<2000|t!nan(+nan,+nan)|q:inf|0.24ms/ev
101|0:00:29|nc:1.3e+05|a0:0.58-0.71|swp:0.41-0.96|n:50<2000|t!1(+nan,+nan)|q:1.00|0.24ms/ev
102|0:00:29|nc:1.3e+05|a0:0.58-0.70|swp:0.41-0.96|n:100<2000|t!1(+nan,+nan)|q:1.00|0.24ms/ev
103|0:00:30|nc:1.3e+05|a0:0.57-0.70|swp:0.41-0.96|n:150<2000|t!1(+nan,+nan)|q:1.00|0.23ms/ev
104|0:00:30|nc:1.3e+05|a0:0.58-0.70|swp:0.41-0.96|n:200<2000|t!1(+nan,+nan)|q:1.00|0.24ms/ev
105|0:00:30|nc:1.3e+05|a0:0.58-0.70|swp:0.41-0.96|n:250<2000|t!1(+nan,+nan)|q:1.00|0.23ms/ev
106|0:00:31|nc:1.3e+05|a0:0.58-0.70|swp:0.41-0.96|n:300<2000|t!1(+nan,+nan)|q:1.00|0.23ms/ev
107|0:00:31|nc:1.3e+05|a0:0.58-0.70|swp:0.41-0.96|n:350<2000|t!1(+nan,+nan)|q:1.00|0.23ms/ev
108|0:00:31|nc:1.4e+05|a0:0.58-0.70|swp:0.41-0.96|n:400<2000|t!1(+nan,+nan)|q:1.00|0.24ms/ev
109|0:00:31|nc:1.4e+05|a0:0.58-0.70|swp:0.41-0.96|n:450<2000|t!1(+nan,+nan)|q:1.00|0.24ms/ev
110|0:00:32|nc:1.4e+05|a0:0.58-0.70|swp:0.41-0.96|n:500<2000|t!1(+nan,+nan)|q:1.00|0.24ms/ev
111|0:00:32|nc:1.4e+05|a0:0.58-0.70|swp:0.41-0.96|n:550<2000|t!1(+nan,+nan)|q:1.00|0.24ms/ev
112|0:00:32|nc:1.4e+05|a0:0.58-0.70|swp:0.41-0.96|n:600<2000|t!1(+nan,+nan)|q:1.00|0.24ms/ev
113|0:00:33|nc:1.4e+05|a0:0.58-0.70|swp:0.41-0.96|n:650<2000|t!1(+nan,+nan)|q:1.00|0.24ms/ev
114|0:00:33|nc:1.4e+05|a0:0.58-0.70|swp:0.41-0.96|n:700<2000|t!1(+nan,+nan)|q:1.00|0.23ms/ev
115|0:00:33|nc:1.4e+05|a0:0.58-0.70|swp:0.41-0.96|n:750<2000|t!1(+nan,+nan)|q:1.00|0.24ms/ev
116|0:00:34|nc:1.4e+05|a0:0.58-0.70|swp:0.41-0.96|n:800<2000|t!1(+nan,+nan)|q:1.00|0.24ms/ev
117|0:00:34|nc:1.5e+05|a0:0.58-0.70|swp:0.41-0.96|n:850<2000|t!1(+nan,+nan)|q:1.00|0.24ms/ev
118|0:00:34|nc:1.5e+05|a0:0.58-0.70|swp:0.41-0.96|n:900<2000|t!1(+nan,+nan)|q:1.00|0.24ms/ev
119|0:00:34|nc:1.5e+05|a0:0.58-0.70|swp:0.41-0.96|n:950<2000|t!1(+nan,+nan)|q:1.00|0.24ms/ev
120|0:00:35|nc:1.5e+05|a0:0.58-0.70|swp:0.41-0.96|n:1000<2000|t!1(+nan,+nan)|q:1.00|0.24ms/ev
121|0:00:35|nc:1.5e+05|a0:0.58-0.70|swp:0.41-0.96|n:1050<2000|t!1(+nan,+nan)|q:1.00|0.24ms/ev
122|0:00:35|nc:1.5e+05|a0:0.58-0.70|swp:0.41-0.96|n:1100<2000|t!1(+nan,+nan)|q:1.00|0.24ms/ev
123|0:00:36|nc:1.5e+05|a0:0.58-0.70|swp:0.41-0.96|n:1150<2000|t!1(+nan,+nan)|q:1.00|0.24ms/ev
124|0:00:36|nc:1.6e+05|a0:0.58-0.70|swp:0.41-0.96|n:1200<2000|t!1(+nan,+nan)|q:1.00|0.24ms/ev
125|0:00:36|nc:1.6e+05|a0:0.58-0.70|swp:0.41-0.96|n:-1250<2000|t!2(+nan,+nan)|q:1.00|0.24ms/ev
126|0:00:37|nc:1.6e+05|a0:0.58-0.70|swp:0.41-0.96|n:-1200<2000|t!2(+nan,+nan)|q:1.00|0.24ms/ev
127|0:00:37|nc:1.6e+05|a0:0.58-0.70|swp:0.41-0.96|n:-1150<2000|t!2(+nan,+nan)|q:1.00|0.24ms/ev
128|0:00:37|nc:1.6e+05|a0:0.58-0.70|swp:0.41-0.96|n:-1100<2000|t!2(+nan,+nan)|q:1.00|0.24ms/ev
129|0:00:37|nc:1.6e+05|a0:0.58-0.70|swp:0.41-0.96|n:-1050<2000|t!2(+nan,+nan)|q:1.00|0.24ms/ev
130|0:00:38|nc:1.6e+05|a0:0.58-0.70|swp:0.41-0.96|n:-1000<2000|t!2(+nan,+nan)|q:1.00|0.24ms/ev
131|0:00:38|nc:1.6e+05|a0:0.58-0.70|swp:0.41-0.96|n:-950<2000|t!2(+nan,+nan)|q:1.00|0.24ms/ev
132|0:00:38|nc:1.6e+05|a0:0.58-0.70|swp:0.41-0.96|n:-900<2000|t!2(+nan,+nan)|q:1.00|0.24ms/ev
133|0:00:39|nc:1.7e+05|a0:0.59-0.70|swp:0.41-0.96|n:-850<2000|t!2(+nan,+nan)|q:1.00|0.24ms/ev
134|0:00:39|nc:1.7e+05|a0:0.59-0.70|swp:0.41-0.96|n:-800<2000|t!2(+nan,+nan)|q:1.00|0.24ms/ev
135|0:00:39|nc:1.7e+05|a0:0.59-0.70|swp:0.41-0.96|n:-750<2000|t!2(+nan,+nan)|q:1.00|0.24ms/ev
136|0:00:39|nc:1.7e+05|a0:0.58-0.69|swp:0.41-0.96|n:-700<2000|t!2(+nan,+nan)|q:1.00|0.24ms/ev
137|0:00:40|nc:1.7e+05|a0:0.58-0.69|swp:0.41-0.96|n:-650<2000|t!2(+nan,+nan)|q:1.00|0.24ms/ev
138|0:00:40|nc:1.7e+05|a0:0.58-0.69|swp:0.41-0.96|n:-600<2000|t!2(+nan,+nan)|q:1.00|0.24ms/ev
139|0:00:40|nc:1.7e+05|a0:0.59-0.69|swp:0.41-0.96|n:-550<2000|t!2(+nan,+nan)|q:1.00|0.23ms/ev
140|0:00:41|nc:1.8e+05|a0:0.58-0.69|swp:0.41-0.96|n:-500<2000|t!2(+nan,+nan)|q:1.00|0.23ms/ev
141|0:00:41|nc:1.8e+05|a0:0.58-0.69|swp:0.41-0.96|n:-450<2000|t!2(+nan,+nan)|q:1.00|0.23ms/ev
142|0:00:41|nc:1.8e+05|a0:0.59-0.69|swp:0.41-0.96|n:-400<2000|t!2(+nan,+nan)|q:1.00|0.24ms/ev
143|0:00:42|nc:1.8e+05|a0:0.59-0.69|swp:0.41-0.96|n:-350<2000|t!2(+nan,+nan)|q:1.00|0.24ms/ev
144|0:00:42|nc:1.8e+05|a0:0.59-0.69|swp:0.41-0.96|n:-300<2000|t!2(+nan,+nan)|q:1.00|0.24ms/ev
145|0:00:42|nc:1.8e+05|a0:0.58-0.69|swp:0.41-0.96|n:-250<2000|t!2(+nan,+nan)|q:1.00|0.24ms/ev
146|0:00:42|nc:1.8e+05|a0:0.59-0.68|swp:0.41-0.96|n:-200<2000|t!2(+nan,+nan)|q:1.00|0.24ms/ev
147|0:00:43|nc:1.8e+05|a0:0.59-0.69|swp:0.41-0.96|n:-150<2000|t!2(+nan,+nan)|q:1.00|0.24ms/ev
148|0:00:43|nc:1.8e+05|a0:0.59-0.69|swp:0.41-0.96|n:-100<2000|t!2(+nan,+nan)|q:1.00|0.24ms/ev
149|0:00:43|nc:1.9e+05|a0:0.59-0.69|swp:0.41-0.96|n:-400<2000|t!2(+nan,+nan)|q:1.00|0.24ms/ev
150|0:00:44|nc:1.9e+05|a0:0.59-0.69|swp:0.41-0.96|n:-350<2000|t!2(+nan,+nan)|q:1.00|0.24ms/ev
151|0:00:44|nc:1.9e+05|a0:0.59-0.68|swp:0.41-0.96|n:-300<2000|t!2(+nan,+nan)|q:1.00|0.24ms/ev
152|0:00:44|nc:1.9e+05|a0:0.59-0.68|swp:0.41-0.96|n:-250<2000|t!2(+0.01,+0.00)|q:1.00|0.24ms/ev
153|0:00:45|nc:1.9e+05|a0:0.59-0.68|swp:0.41-0.96|n:-200<2000|t!2(+0.01,+0.00)|q:1.00|0.26ms/ev
154|0:00:45|nc:1.9e+05|a0:0.59-0.68|swp:0.41-0.96|n:-150<2000|t!2(+0.01,+0.01)|q:1.00|0.26ms/ev
155|0:00:45|nc:1.9e+05|a0:0.59-0.68|swp:0.41-0.96|n:-100<2000|t!2(+0.01,+0.01)|q:1.00|0.26ms/ev
156|0:00:46|nc:2.0e+05|a0:0.59-0.68|swp:0.41-0.96|n:-50<2000|t!2(+0.01,+0.01)|q:1.00|0.24ms/ev
157|0:00:46|nc:2.0e+05|a0:0.59-0.68|swp:0.41-0.96|n:0<2000|t=2(+0.01,+0.01)|q:1.00|0.24ms/ev
158|0:00:46|nc:2.0e+05|a0:0.59-0.68|swp:0.41-0.96|n:50<2000|t=2(+0.01,+0.01)|q:1.00|0.24ms/ev
159|0:00:46|nc:2.0e+05|a0:0.60-0.68|swp:0.41-0.96|n:100<2000|t=2(+0.01,+0.01)|q:1.00|0.24ms/ev
160|0:00:47|nc:2.0e+05|a0:0.60-0.68|swp:0.41-0.96|n:150<2000|t=2(+0.01,+0.01)|q:1.00|0.24ms/ev
161|0:00:47|nc:2.0e+05|a0:0.60-0.68|swp:0.41-0.96|n:200<2000|t=2(+0.01,+0.01)|q:1.00|0.24ms/ev
162|0:00:47|nc:2.0e+05|a0:0.60-0.68|swp:0.41-0.96|n:250<2000|t=2(+0.01,+0.01)|q:1.00|0.24ms/ev
163|0:00:48|nc:2.0e+05|a0:0.60-0.68|swp:0.41-0.96|n:300<2000|t=2(+0.01,+0.00)|q:1.00|0.24ms/ev
164|0:00:48|nc:2.0e+05|a0:0.60-0.68|swp:0.41-0.96|n:350<2000|t=2(+0.01,+0.00)|q:1.00|0.23ms/ev
165|0:00:48|nc:2.1e+05|a0:0.60-0.68|swp:0.41-0.96|n:400<2000|t=2(+0.01,+0.01)|q:1.00|0.24ms/ev
166|0:00:48|nc:2.1e+05|a0:0.60-0.68|swp:0.41-0.96|n:450<2000|t=2(+0.01,+0.01)|q:1.00|0.24ms/ev
167|0:00:49|nc:2.1e+05|a0:0.60-0.68|swp:0.41-0.96|n:500<2000|t=2(+0.01,+0.01)|q:1.00|0.24ms/ev
168|0:00:49|nc:2.1e+05|a0:0.60-0.68|swp:0.41-0.96|n:550<2000|t=2(+0.01,+0.00)|q:1.00|0.23ms/ev
169|0:00:49|nc:2.1e+05|a0:0.60-0.68|swp:0.41-0.96|n:600<2000|t=2(+0.01,+0.01)|q:1.00|0.24ms/ev
170|0:00:50|nc:2.1e+05|a0:0.60-0.68|swp:0.41-0.96|n:650<2000|t=2(+0.01,+0.01)|q:1.00|0.24ms/ev
171|0:00:50|nc:2.1e+05|a0:0.60-0.68|swp:0.41-0.96|n:700<2000|t=2(+0.01,+0.01)|q:1.00|0.24ms/ev
172|0:00:50|nc:2.2e+05|a0:0.60-0.68|swp:0.41-0.96|n:750<2000|t=2(+0.01,+0.01)|q:1.00|0.24ms/ev
173|0:00:51|nc:2.2e+05|a0:0.60-0.68|swp:0.41-0.96|n:800<2000|t=2(+0.01,+0.01)|q:1.00|0.24ms/ev
174|0:00:51|nc:2.2e+05|a0:0.60-0.69|swp:0.41-0.96|n:850<2000|t=2(+0.01,+0.00)|q:1.00|0.24ms/ev
175|0:00:51|nc:2.2e+05|a0:0.60-0.69|swp:0.41-0.96|n:900<2000|t=2(+0.01,+0.00)|q:1.00|0.24ms/ev
176|0:00:51|nc:2.2e+05|a0:0.60-0.69|swp:0.41-0.96|n:950<2000|t=2(+0.01,+0.00)|q:1.00|0.24ms/ev
177|0:00:52|nc:2.2e+05|a0:0.60-0.69|swp:0.41-0.96|n:1000<2000|t=2(+0.01,+0.01)|q:1.00|0.24ms/ev
178|0:00:52|nc:2.2e+05|a0:0.60-0.69|swp:0.41-0.96|n:1050<2000|t=2(+0.01,+0.01)|q:1.00|0.24ms/ev
179|0:00:52|nc:2.2e+05|a0:0.60-0.69|swp:0.41-0.96|n:1100<2000|t=2(+0.01,+0.01)|q:1.00|0.24ms/ev
180|0:00:53|nc:2.2e+05|a0:0.60-0.69|swp:0.41-0.96|n:1150<2000|t=2(+0.01,+0.01)|q:1.00|0.24ms/ev
181|0:00:53|nc:2.3e+05|a0:0.60-0.69|swp:0.41-0.96|n:1200<2000|t=2(+0.01,+0.02)|q:1.00|0.24ms/ev
182|0:00:53|nc:2.3e+05|a0:0.60-0.69|swp:0.41-0.96|n:1250<2000|t=2(+0.01,+0.02)|q:1.00|0.24ms/ev
183|0:00:54|nc:2.3e+05|a0:0.60-0.69|swp:0.41-0.96|n:1300<2000|t=2(+0.01,+0.02)|q:1.00|0.24ms/ev
184|0:00:54|nc:2.3e+05|a0:0.60-0.68|swp:0.41-0.96|n:1350<2000|t=2(+0.01,+0.01)|q:1.00|0.24ms/ev
185|0:00:54|nc:2.3e+05|a0:0.60-0.68|swp:0.41-0.96|n:1400<2000|t=2(+0.01,+0.01)|q:1.00|0.24ms/ev
186|0:00:54|nc:2.3e+05|a0:0.60-0.68|swp:0.41-0.96|n:1450<2000|t=2(+0.01,+0.01)|q:1.00|0.24ms/ev
187|0:00:55|nc:2.3e+05|a0:0.60-0.68|swp:0.41-0.96|n:1500<2000|t=2(+0.01,+0.01)|q:1.00|0.24ms/ev
188|0:00:55|nc:2.4e+05|a0:0.60-0.68|swp:0.41-0.96|n:1550<2000|t=2(+0.01,+0.01)|q:1.00|0.24ms/ev
189|0:00:55|nc:2.4e+05|a0:0.61-0.68|swp:0.41-0.96|n:1600<2000|t=2(+0.01,+0.00)|q:1.00|0.24ms/ev
190|0:00:56|nc:2.4e+05|a0:0.61-0.68|swp:0.41-0.96|n:1650<2000|t=2(+0.01,+0.00)|q:1.00|0.24ms/ev
191|0:00:56|nc:2.4e+05|a0:0.61-0.68|swp:0.41-0.96|n:1700<2000|t=2(+0.01,+0.00)|q:1.00|0.24ms/ev
192|0:00:56|nc:2.4e+05|a0:0.61-0.68|swp:0.41-0.96|n:1750<2000|t=2(+0.01,+0.00)|q:1.00|0.24ms/ev
193|0:00:57|nc:2.4e+05|a0:0.61-0.68|swp:0.41-0.96|n:1800<2000|t=2(+0.01,+0.01)|q:1.00|0.24ms/ev
194|0:00:57|nc:2.4e+05|a0:0.61-0.68|swp:0.41-0.96|n:1850<2000|t=2(+0.01,+0.00)|q:1.00|0.24ms/ev
195|0:00:57|nc:2.4e+05|a0:0.61-0.68|swp:0.41-0.96|n:1900<2000|t=2(+0.01,+0.00)|q:1.00|0.24ms/ev
196|0:00:57|nc:2.4e+05|a0:0.61-0.68|swp:0.41-0.96|n:1950<2000|t=2(+0.01,+0.01)|q:1.00|0.24ms/ev
197|0:00:58|nc:2.5e+05|a0:0.60-0.68|swp:0.41-0.96|n:2000<2000|t=2(+0.01,+0.01)|q:1.00|0.24ms/ev
198|0:00:58|nc:2.5e+05|a0:0.60-0.68|swp:0.41-0.96|n:2050<2000|t=2(+0.01,+0.01)|q:1.00|0.24ms/ev
20:00 bilby INFO : Finished sampling
20:00 bilby INFO : Writing checkpoint and diagnostics
20:00 bilby INFO : Finished writing checkpoint
20:00 bilby INFO : Sampling time: 0:00:58.543465
20:00 bilby WARNING : Result.save_to_file called with extension=True. This will default to json, and ignore the extension from the filename. This behaviour is deprecated and will be removed.
20:00 bilby WARNING : Result.save_to_file called with extension=True. This will default to json, and ignore the extension from the filename. This behaviour is deprecated and will be removed.
20:00 bilby INFO : Summary of results:
nsamples: 2050
ln_noise_evidence: nan
ln_evidence: 0.440 +/- 2.340
ln_bayes_factor: nan +/- 2.340
# Posterior of the mixing parameters.
result.plot_corner()
#corner plots
import corner
fig, axs = plt.subplots(2,2, figsize=(6,6), dpi=200)
corner.corner(mix_model.posterior,labels=['cdf_0','cdf_1'],quantiles=[0.16, 0.5, 0.84],fig=fig)
plt.show()
2.2.4. 4. Predictions#
_,mean_prior,CI_prior, _ = mix_model.prior_predict(plot_g, CI=[5,20,80,95])
_,mean,CI, _ = mix_model.predict(plot_g, CI=[5,20,80,95])
(10000, 2)
using provided samples instead of posterior
per5, per20, per80, per95 = CI
prior5, prior20, prior80, prior95 = CI_prior
# Map value prediction for the step mixing function parameter
map_prediction = mix_model.evaluate(mix_model.map, plot_g)
%matplotlib inline
sns.set_context('poster')
fig, ax = plt.subplots(figsize=(10,10))
ax.plot(plot_g, mean.flatten(), label='posterior mean')
ax.fill_between(plot_g,per5.flatten(),per95.flatten(),color=sns.color_palette()[4], alpha=0.2, label='90% C.I.')
ax.fill_between(plot_g,per20.flatten(),per80.flatten(), color=sns.color_palette()[4], alpha=0.3, label='60% C.I.')
ax.fill_between(plot_g,prior20.flatten(),prior80.flatten(),color=sns.color_palette()[2], alpha=0.2, label='60% C.I. Prior')
ax.scatter(g,exp_data[0], marker='x', label='experimental data')
ax.plot(plot_g, mean_prior.flatten(), label='prior mean')
ax.plot(plot_g, map_prediction.flatten(), label='MAP prediction')
ax.set_ybound(1,3)
ax.legend()
<matplotlib.legend.Legend at 0x7f032bbf0440>