Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pytorch #14

Open
wants to merge 109 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
109 commits
Select commit Hold shift + click to select a range
2b04615
updated ndes.py with tf2 MDN (no MAF or MADE yet)
justinalsing Jan 31, 2020
236e3bf
added sample() function to MDN
justinalsing Feb 1, 2020
e564414
added first version of MADE and MAF, needs debugging once training cl…
justinalsing Feb 1, 2020
7fb0a43
fixed name scope of MADEs in MAF
justinalsing Feb 1, 2020
f5e8570
TF2 training module: need to integrate and test
sfeeney Feb 6, 2020
491ba5e
TF version requirement so we don't forget!
sfeeney Feb 6, 2020
9b73fa4
stitched together new training and ndes classes, cleared TF1 bits (se…
justinalsing Feb 18, 2020
83f9728
Merge branch 'tf2' of https://github.com/justinalsing/pydelfi into tf2
justinalsing Feb 18, 2020
e3f45ef
fixed all tf2 NDEs including conditional MADE and MAF
justinalsing Mar 13, 2020
e81756f
updated getdist behaviour and way we interact with emcee
justinalsing Mar 13, 2020
4fbf071
changed emcee initialization based on top nwalkers samples
justinalsing Mar 13, 2020
3e9f58c
updated example notebooks to work with new interface, expect priors. …
justinalsing Mar 13, 2020
90c1ec4
adjusted emcee initialization scheme again, cutting off bottom 10% of…
justinalsing Mar 13, 2020
b148b88
updated all priors in examples to tfd, updated versions of requiremen…
justinalsing Mar 13, 2020
9b091ba
fixed restore capabilities in saver() function in delfi.py
justinalsing Mar 13, 2020
6de4847
MAF in tfp working (cannot yet sample) - working on efficient trainin…
Mar 15, 2020
dd4f304
fixed triangle plot to use weights if passes and changed tight_layout…
justinalsing Mar 16, 2020
3d474cf
Working upto fisher pretraining. Need to change proposal in sequentia…
Mar 16, 2020
bb8fbb2
Working delfi
Mar 17, 2020
852be74
typo in setup.py
Mar 17, 2020
1f60ca5
Changed some float value issues
Mar 17, 2020
e49fb70
removed priors.py
Mar 18, 2020
49001af
TF2 update (done?)
Mar 23, 2020
43992fb
changed loss to look like KL divergence (reduce_sum changed to reduce…
justinalsing Mar 27, 2020
7fee5cd
fixed size of training/validation sets with tf.random.shuffle instead…
justinalsing Mar 27, 2020
aee37a5
fixed batching of training and val data to put them on same scale
justinalsing Mar 27, 2020
f704179
fixed number of sig figs on tqdm outputs
justinalsing Mar 27, 2020
00e0990
fixed number of sig figs on tqdm outputs attempt 2
justinalsing Mar 27, 2020
2b43839
made MDN full rank
justinalsing Mar 28, 2020
ce60638
re-introduced normalization into training data and thetas
justinalsing Mar 31, 2020
7a4b9f9
re-introduced normalization into posterior and proposal density calls
justinalsing Mar 31, 2020
2a5e824
fixed types on normalization constants
justinalsing Mar 31, 2020
7ee1c07
fixed normalization in fisher pretraining
justinalsing Mar 31, 2020
af51955
correct order of theta and data inputs in training epoch steps
justinalsing Mar 31, 2020
0c9243b
separated priors and likelihoods in emcee calls
justinalsing Mar 31, 2020
2a966b1
separated priors and likelihoods in emcee calls, fixed .numpy()
justinalsing Mar 31, 2020
e82027f
renamed MAF to MADE and added a MAF (stack of MADEs)
justinalsing Mar 31, 2020
18bc92f
added option for auto normalization of inputs/outputs
justinalsing Mar 31, 2020
6501717
changed default learning rate
justinalsing Mar 31, 2020
a968e93
tried adding conditionals to tfb.Chain call
justinalsing Mar 31, 2020
f00a5c6
tried adding conditionals to tfb.Chain call attempt 2
justinalsing Mar 31, 2020
70a2847
updated jla_sne notebook
justinalsing Apr 1, 2020
43f1309
added old MADE and MAF temporarily for testing
justinalsing Apr 1, 2020
6461ecc
added old MADE and MAF temporarily for testing, fixed super() calls
justinalsing Apr 1, 2020
723f384
added old MADE and MAF temporarily for testing, fixed names
justinalsing Apr 1, 2020
5ee3c3d
added numpy import to ndes.py for the old MAF/MADE
justinalsing Apr 1, 2020
b68a897
added temporary global dtype to ndes.py for the old MAF/MADE
justinalsing Apr 1, 2020
fed018c
added conditional args to old MAF/MADE
justinalsing Apr 1, 2020
9765c8f
added conditional args to old MAF/MADE attempt 2
justinalsing Apr 1, 2020
4475b6d
Added initialiser argument
Apr 1, 2020
f0547a7
Pulling (and removing) old MAF
Apr 1, 2020
4b6186c
added defauly kernel initializer to MDNs
justinalsing Apr 1, 2020
285ea18
added authors to the setup.py
justinalsing Apr 1, 2020
2a3a994
changed default kernel_initializer
justinalsing Apr 2, 2020
519b82e
wrapped fit() in delfi.py for easy calling when running on pre-run si…
justinalsing Apr 2, 2020
cbec196
wrapped fit() in delfi.py for easy calling when running on pre-run si…
justinalsing Apr 2, 2020
b693da3
wrapped fit() in delfi.py for easy calling when running on pre-run si…
justinalsing Apr 2, 2020
f82bcca
wrapped fit() in delfi.py for easy calling when running on pre-run si…
justinalsing Apr 2, 2020
332a76a
catching nans in log proposal and posterior calls
justinalsing Apr 2, 2020
ae4c8cd
condensed emcee initialization scheme
justinalsing Apr 2, 2020
5e8de66
condensed emcee initialization scheme attempt 2
justinalsing Apr 2, 2020
18c26e9
condensed emcee initialization scheme attempt 3
justinalsing Apr 2, 2020
6767aaf
fixed bug in log_prob values from emcee sampler
justinalsing Apr 3, 2020
4c0f674
checked against tf-nightly and tfp-nightly
Apr 13, 2020
ad4cc2b
Added version info
Apr 13, 2020
71db448
Slight redefinition in tfp
Apr 14, 2020
6a7065d
Merge branch 'tf2-tom' of https://github.com/justinalsing/pydelfi int…
Apr 14, 2020
882a165
MAF definition
Apr 14, 2020
e1ee943
Modifications to MAF to make it compatible with tfp - not the most el…
Apr 29, 2020
d1fee87
Forgot to change to a conditional_prob()
Apr 29, 2020
39d30cf
added extra @tf.function
Apr 29, 2020
5338765
set correct tf-nightly in setup.py
Apr 30, 2020
6251d6b
fixed truncated multivariate normal and emcee initialization
justinalsing May 5, 2020
237a33b
updated setup.py
justinalsing Sep 23, 2020
437dea7
fixed keyword conditional_event_shape in conditional MAF code
justinalsing Sep 23, 2020
10d9f05
changed conditional to conditional_input in MAF
justinalsing Sep 23, 2020
e9b2ebb
updated setup.py with correct tf and tfp versions
justinalsing Sep 23, 2020
b3b5ea7
updated requirements in setup.py
justinalsing Sep 23, 2020
991f0bd
Update README.md
justinalsing Sep 23, 2020
ac8860f
fixed saver() in sequential training and filename path bug
justinalsing Nov 5, 2020
8cbec89
killed buggy axis label rotaiton on getdist plots
justinalsing Nov 17, 2020
909df87
added sinharcsinh mades
justinalsing Apr 3, 2021
07e278e
added conditional functions to sinh MADEs
justinalsing Apr 3, 2021
947e7b7
initialize variables in sinh made
justinalsing Apr 3, 2021
9e8b680
changed optimizer defaults
justinalsing Apr 3, 2021
ed5eb49
replaced emcee with tf affine sampler
justinalsing Apr 3, 2021
bfc1ac9
replaced emcee with tf affine sampler, fixed import
justinalsing Apr 3, 2021
9d85dcf
replaced emcee with tf affine sampler, fixed self bug
justinalsing Apr 3, 2021
60bccbd
replaced emcee with tf affine sampler, fixed self bug in fisher pretr…
justinalsing Apr 3, 2021
16cd49d
replaced emcee with tf affine sampler, fixed n_walkers typo
justinalsing Apr 3, 2021
80ac9d3
fixed sampling progress bar
justinalsing Apr 3, 2021
7a21e4c
fixed sampling progress bar take II
justinalsing Apr 3, 2021
9d6a6b9
removed posterior weighting for triangle plots
justinalsing Apr 3, 2021
5d38a34
added burn in steps
justinalsing Apr 3, 2021
a3a56af
changed x0 initialization back
justinalsing Apr 3, 2021
6a2fdcc
fixed shapes of stack probabilities
justinalsing Apr 4, 2021
673b51e
fixed shapes of stack probabilities take II
justinalsing Apr 4, 2021
60de9e4
fixed shapes of stack probabilities take III
justinalsing Apr 4, 2021
5d3cd6c
fixed shapes of stack probabilities take IV
justinalsing Apr 4, 2021
0b871b8
testing @tf.function behaviour of sinharcsinh made
justinalsing Apr 4, 2021
1534546
changed weighted prob to logsumexp
justinalsing Apr 4, 2021
c626071
purged some python natives
justinalsing Apr 4, 2021
ef473fe
purged some python natives II
justinalsing Apr 4, 2021
c4cfe22
clipped output of affine sampler
justinalsing Apr 4, 2021
217e81d
added weighting of affine samples for GetDist
justinalsing Apr 6, 2021
314029e
added weighting of affine samples for GetDist II
justinalsing Apr 6, 2021
6d95161
updated examples
justinalsing Apr 6, 2021
5ebb0ef
tf 2.4 use
NiallJeffrey Apr 6, 2021
ddc98b5
removed event shape bug in MAFs
justinalsing Jan 16, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 28 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,48 @@
# pydelfi

**NOTE:** currently only works with tensorflow <= 1.15; tensorflow 2 update coming soon.

**Density Estimation Likelihood-Free Inference** with neural density estimators and adaptive acquisition of simulations. The implemented methods are described in detail in [Alsing, Charnock, Feeney and Wandelt 2019](https://arxiv.org/abs/1903.00007), and are based closely on [Papamakarios, Sterratt and Murray 2018](https://arxiv.org/pdf/1805.07226.pdf), [Lueckmann et al 2018](https://arxiv.org/abs/1805.09294) and [Alsing, Wandelt and Feeney, 2018](https://academic.oup.com/mnras/article-abstract/477/3/2874/4956055?redirectedFrom=fulltext). Please cite these papers if you use this code!

**Installation:**

The code is in python3 and has the following dependencies:<br>
The code is in python3. There is a Tensorflow 1 (most stable, see below) and Tensorflow 2 version that can be installed as follows:<br>

**Tensorflow 1 (stable)**

This can be found on the master branch and has the following dependencies:<br>
[tensorflow](https://www.tensorflow.org) (<=1.15) <br>
[getdist](http://getdist.readthedocs.io/en/latest/)<br>
[emcee](http://dfm.io/emcee/current/)<br>
[emcee](http://dfm.io/emcee/current/) (>=3.0.2)<br>
[tqdm](https://github.com/tqdm/tqdm)<br>
[mpi4py](https://mpi4py.readthedocs.io/en/stable/) (if MPI is required)<br>

You can install the requirements and this package with,

```
pip install tensorflow==1.15
pip install git+https://github.com/justinalsing/pydelfi.git
```
(`tensorflow-gpu==1.15` for GPU acceleration instead of `tensorflow==1.15`)

or alternatively, pip install the requirements and then clone the repo and run `python setup.py install`

**Tensorflow 2**

The Tensorflow 2 version can be found on the `tf2-tom` branch and can be installed as follows. We reccommend you do the install inside a virtual environment to keep version conflicts under control, ie.,

```
mkdir ~/envs
virtualenv ~/envs/pydelfi
source ~/envs/pydelfi/bin/activate
```

Followed by a pip install of pydelfi:

```
pip install git+https://github.com/justinalsing/pydelfi.git@tf2-tom
```

Note: the Mixture Density Networks (MDN) in the tf2 version are currently not performing as well as in the tf1 version (but the Masked Autoregressive Flows are fine). We are getting ot the bottom of this, and also working on expanding the suite of conditional density estimators in a coming update. Watch this space.

**Documentation and tutorials:**

Once everything is installed, try out either `cosmic_shear.ipynb` or `jla_sne.ipynb` as example templates for how to use the code; plugging in your own simulator and letting pydelfi do it's thing.
Expand Down
190 changes: 139 additions & 51 deletions examples/cosmic_shear.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,28 @@
"metadata": {},
"outputs": [],
"source": [
"import sys\n",
"import tensorflow as tf\n",
"import numpy as np\n",
"import matplotlib.pyplot as plt\n",
"import getdist\n",
"from getdist import plots, MCSamples\n",
"import pydelfi.priors as priors\n",
"import pydelfi.ndes as ndes\n",
"import pydelfi.delfi as delfi\n",
"import tensorflow as tf\n",
"import pydelfi.score as score\n",
"import simulators.cosmic_shear.cosmic_shear as cosmic_shear\n",
"import pickle\n",
"import pydelfi.score as score\n",
"tf.logging.set_verbosity(tf.logging.ERROR)\n",
"%matplotlib inline"
"import tensorflow_probability as tfp\n",
"tfd = tfp.distributions"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Set up the simulator\n",
"This must have the signature `simulator(parameters, seed, args, batch)` -> `np.array([batch, ndata])`"
]
},
{
Expand All @@ -27,37 +36,45 @@
"metadata": {},
"outputs": [],
"source": [
"### SET UP THE SIMULATOR ###\n",
"\n",
"# Set up the tomography simulations\n",
"CosmicShearSimulator = cosmic_shear.TomographicCosmicShear(pz = pickle.load(open('simulators/cosmic_shear/pz_5bin.pkl', 'rb')),\n",
" lmin = 10, lmax = 1000, n_ell_bins = 5, \n",
" sigma_e = 0.3, nbar = 30, Area = 15000)\n",
"\n",
"# Simulator function: This must be of the form simulator(theta, seed, args) -> simulated data vector\n",
"def simulator(theta, seed, simulator_args, batch=1):\n",
" return CosmicShearSimulator.simulate(theta, seed)\n",
"\n",
"# Simulator arguments\n",
"simulator_args = None"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Set up the prior"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [],
"source": [
"### SET UP THE PRIOR ###\n",
"lower = np.array([0, 0.4, 0, 0.4, 0.7]).astype('float32')\n",
"upper = np.array([1, 1.2, 0.1, 1.0, 1.3]).astype('float32')\n",
"prior_mean = np.array([0.3, 0.8, 0.05, 0.70, 0.96]).astype('float32')\n",
"prior_covariance = (np.eye(5)*np.array([0.1, 0.1, 0.05, 0.3, 0.3])**2).astype('float32')\n",
"prior_stddev = np.sqrt(np.diag(prior_covariance))\n",
"\n",
"# Define the priors parameters\n",
"lower = np.array([0, 0.4, 0, 0.4, 0.7])\n",
"upper = np.array([1, 1.2, 0.1, 1.0, 1.3])\n",
"prior_mean = np.array([0.3, 0.8, 0.05, 0.70, 0.96])\n",
"prior_covariance = np.eye(5)*np.array([0.1, 0.1, 0.05, 0.3, 0.3])**2\n",
"\n",
"# Prior\n",
"prior = priors.TruncatedGaussian(prior_mean, prior_covariance, lower, upper)"
"prior = tfd.Blockwise([tfd.TruncatedNormal(loc=prior_mean[i], scale=prior_stddev[i], low=lower[i], high=upper[i]) for i in range(5)])"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Set up the compressor\n",
"Must have the signature `compressor(data, args)` -> `np.array([n_summaries])`<br>\n",
"In this case we are going to do Wishart score compression."
]
},
{
Expand All @@ -66,8 +83,6 @@
"metadata": {},
"outputs": [],
"source": [
"### SET UP THE COMPRESSOR ###\n",
"\n",
"# Fiducial parameters\n",
"theta_fiducial = np.array([0.3, 0.8, 0.05, 0.70, 0.96])\n",
"\n",
Expand All @@ -94,39 +109,85 @@
"compressor_args = None"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Generate mock data vector"
]
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": 5,
"metadata": {},
"outputs": [],
"source": [
"### GENERATE MOCK DATA VECTOR ###\n",
"\n",
"seed = 0\n",
"data = simulator(theta_fiducial, seed, simulator_args)\n",
"compressed_data = compressor(data, compressor_args)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Create ensemble of NDEs"
]
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 6,
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"WARNING:tensorflow:From /obs/njeffrey/envs/delfi2env/lib/python3.7/site-packages/tensorflow/python/ops/linalg/linear_operator_lower_triangular.py:167: calling LinearOperator.__init__ (from tensorflow.python.ops.linalg.linear_operator) with graph_parents is deprecated and will be removed in a future version.\n",
"Instructions for updating:\n",
"Do not pass `graph_parents`. They will no longer be used.\n",
"WARNING:tensorflow:From /obs/njeffrey/envs/delfi2env/lib/python3.7/site-packages/tensorflow_probability/python/distributions/distribution.py:334: calling TransformedDistribution.__init__ (from tensorflow_probability.python.distributions.transformed_distribution) with batch_shape is deprecated and will be removed after 2020-06-01.\n",
"Instructions for updating:\n",
"`batch_shape` and `event_shape` args are deprecated. Please use `tfd.Sample`, `tfd.Independent`, and broadcasted parameters of the base distribution instead. For example, replace `tfd.TransformedDistribution(tfd.Normal(0., 1.), tfb.Exp(), batch_shape=[2, 3], event_shape=[4])` with `tfd.TransformedDistrbution(tfd.Sample(tfd.Normal(tf.zeros([2, 3]), 1.),sample_shape=[4]), tfb.Exp())` or `tfd.TransformedDistribution(tfd.Independent(tfd.Normal(tf.zeros([2, 3, 4]), 1.), reinterpreted_batch_ndims=1), tfb.Exp())`.\n",
"WARNING:tensorflow:From /obs/njeffrey/envs/delfi2env/lib/python3.7/site-packages/tensorflow_probability/python/distributions/distribution.py:334: calling TransformedDistribution.__init__ (from tensorflow_probability.python.distributions.transformed_distribution) with event_shape is deprecated and will be removed after 2020-06-01.\n",
"Instructions for updating:\n",
"`batch_shape` and `event_shape` args are deprecated. Please use `tfd.Sample`, `tfd.Independent`, and broadcasted parameters of the base distribution instead. For example, replace `tfd.TransformedDistribution(tfd.Normal(0., 1.), tfb.Exp(), batch_shape=[2, 3], event_shape=[4])` with `tfd.TransformedDistrbution(tfd.Sample(tfd.Normal(tf.zeros([2, 3]), 1.),sample_shape=[4]), tfb.Exp())` or `tfd.TransformedDistribution(tfd.Independent(tfd.Normal(tf.zeros([2, 3, 4]), 1.), reinterpreted_batch_ndims=1), tfb.Exp())`.\n"
]
}
],
"source": [
"# Create an ensemble of NDEs\n",
"NDEs = [ndes.ConditionalMaskedAutoregressiveFlow(n_parameters=5, n_data=5, n_hiddens=[50,50], n_mades=5, act_fun=tf.tanh, index=0),\n",
" ndes.MixtureDensityNetwork(n_parameters=5, n_data=5, n_components=1, n_hidden=[30,30], activations=[tf.tanh, tf.tanh], index=1),\n",
" ndes.MixtureDensityNetwork(n_parameters=5, n_data=5, n_components=2, n_hidden=[30,30], activations=[tf.tanh, tf.tanh], index=2),\n",
" ndes.MixtureDensityNetwork(n_parameters=5, n_data=5, n_components=3, n_hidden=[30,30], activations=[tf.tanh, tf.tanh], index=3),\n",
" ndes.MixtureDensityNetwork(n_parameters=5, n_data=5, n_components=4, n_hidden=[30,30], activations=[tf.tanh, tf.tanh], index=4),\n",
" ndes.MixtureDensityNetwork(n_parameters=5, n_data=5, n_components=5, n_hidden=[30,30], activations=[tf.tanh, tf.tanh], index=5)]\n",
"NDEs = [ndes.ConditionalMaskedAutoregressiveFlow(\n",
" n_parameters=5,\n",
" n_data=5,\n",
" n_mades=5,\n",
" n_hidden=[30,30], \n",
" activation=tf.keras.layers.LeakyReLU(0.01),\n",
" kernel_initializer=tf.keras.initializers.RandomNormal(mean=0.0, stddev=1e-5, seed=None),\n",
" all_layers=True)]\n",
"\n",
"NDEs += [ndes.MixtureDensityNetwork(\n",
" n_parameters=5,\n",
" n_data=5, \n",
" n_components=i+1,\n",
" n_hidden=[30], \n",
" activation=tf.keras.layers.LeakyReLU(0.01))\n",
" for i in range(5)]\n",
"\n",
"# Create the DELFI object\n",
"DelfiEnsemble = delfi.Delfi(compressed_data, prior, NDEs, Finv=Finv, theta_fiducial=theta_fiducial, \n",
" param_limits = [lower, upper],\n",
" param_names = ['\\Omega_m', 'S_8', '\\Omega_b', 'h', 'n_s'], \n",
" results_dir = \"simulators/cosmic_shear/results/\",\n",
" input_normalization='fisher')"
"NDEs += [ndes.SinhArcSinhMADE(\n",
" n_parameters=5,\n",
" n_data=5,\n",
" n_hidden=[64],\n",
" activation=tf.tanh,\n",
" kernel_initializer=tf.keras.initializers.RandomNormal(mean=0.0, stddev=1e-5, seed=None),\n",
" bias_initializer=tf.keras.initializers.RandomNormal(mean=0.0, stddev=1e-5, seed=None)\n",
" )]"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Create DELFI object"
]
},
{
Expand All @@ -135,8 +196,42 @@
"metadata": {},
"outputs": [],
"source": [
"# Do the Fisher pre-training\n",
"DelfiEnsemble.fisher_pretraining()"
"DelfiEnsemble = delfi.Delfi(compressed_data, prior, NDEs, \n",
" Finv=Finv, \n",
" theta_fiducial=theta_fiducial,\n",
" param_limits = [lower, upper],\n",
" param_names=['\\Omega_m', 'S_8', '\\Omega_b', 'h', 'n_s'], \n",
" results_dir=\"simulators/cosmic_shear/results\",\n",
" filename=\"cosmic_shear\",\n",
" optimiser=tf.keras.optimizers.Adam(lr=1e-4),\n",
" optimiser_arguments=None,\n",
" dtype=tf.float32,\n",
" posterior_chain_length=200,\n",
" nwalkers=500,\n",
" input_normalization=\"fisher\")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Fisher pre-training to initialize NDEs"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"# DelfiEnsemble.fisher_pretraining(n_batch=5000, epochs=1000, patience=20, plot=True)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Sequential Neural Likelihood"
]
},
{
Expand All @@ -151,22 +246,15 @@
"n_populations = 39\n",
"\n",
"# Do the SNL training\n",
"DelfiEnsemble.sequential_training(simulator, compressor, n_initial, n_batch, n_populations, patience=10, save_intermediate_posteriors=True)"
"DelfiEnsemble.sequential_training(simulator, compressor, n_initial, n_batch, n_populations, patience=10, plot=True, save_intermediate_posteriors=True)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"display_name": "delfi2env",
"language": "python",
"name": "python3"
"name": "delfi2env"
},
"language_info": {
"codemirror_mode": {
Expand All @@ -178,7 +266,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.5"
"version": "3.7.3"
}
},
"nbformat": 4,
Expand Down
Loading