Skip to content

Commit fbb864f

Browse files
josephwillardtwiecki
authored andcommitted
Remove live plots #3411 (#3445)
* remove all references to live plots * remove references to live_sample_plots * remove miscellaneous files * update RELEASE-NOTES * remove more references to live_plot * rebase with master * remove miscellaneous files * remove unused plot import from pymc3/sampling.py
1 parent c8d8ee1 commit fbb864f

File tree

4 files changed

+6
-145
lines changed

4 files changed

+6
-145
lines changed

RELEASE-NOTES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636

3737
- `nuts_kwargs` and `step_kwargs` have been deprecated in favor of using the standard `kwargs` to pass optional step method arguments.
3838
- `SGFS` and `CSG` have been removed (Fix for [#3353](https://github.com/pymc-devs/pymc3/issues/3353)). They have been moved to [pymc3-experimental](https://github.com/pymc-devs/pymc3-experimental).
39+
- References to `live_plot` and corresponding notebooks have been removed.
3940

4041
## PyMC3 3.6 (Dec 21 2018)
4142

docs/source/notebooks/live_sample_plots.ipynb

Lines changed: 0 additions & 122 deletions
This file was deleted.

docs/source/notebooks/table_of_contents_tutorials.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,5 @@ Gallery.contents = {
1616
"howto_debugging": "How-To",
1717
"model_averaging": "How-To",
1818
"updating_priors": "How-To",
19-
"live_sample_plots": "How-To",
2019
"lasso_block_update": "How-To"
2120
}

pymc3/sampling.py

Lines changed: 5 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
from .util import update_start_vals, get_untransformed_name, is_transformed_name, get_default_varnames
1818
from .vartypes import discrete_types
1919
from pymc3.step_methods.hmc import quadpotential
20-
from pymc3 import plots
2120
import pymc3 as pm
2221
from tqdm import tqdm
2322

@@ -189,8 +188,8 @@ def _cpu_count():
189188

190189
def sample(draws=500, step=None, init='auto', n_init=200000, start=None, trace=None, chain_idx=0,
191190
chains=None, cores=None, tune=500, progressbar=True,
192-
model=None, random_seed=None, live_plot=False, discard_tuned_samples=True,
193-
live_plot_kwargs=None, compute_convergence_checks=True, **kwargs):
191+
model=None, random_seed=None, discard_tuned_samples=True,
192+
compute_convergence_checks=True, **kwargs):
194193
"""Draw samples from the posterior using the given step methods.
195194
196195
Multiple step methods are supported via compound step methods.
@@ -262,11 +261,6 @@ def sample(draws=500, step=None, init='auto', n_init=200000, start=None, trace=N
262261
model : Model (optional if in `with` context)
263262
random_seed : int or list of ints
264263
A list is accepted if `cores` is greater than one.
265-
live_plot : bool
266-
Flag for live plotting the trace while sampling. Ignored when using 'SMC'.
267-
live_plot_kwargs : dict
268-
Options for traceplot. Example: live_plot_kwargs={'varnames': ['x']}.
269-
Ignored when using 'SMC'
270264
discard_tuned_samples : bool
271265
Whether to discard posterior samples of the tune interval. Ignored when using 'SMC'
272266
compute_convergence_checks : bool, default=True
@@ -423,8 +417,6 @@ def sample(draws=500, step=None, init='auto', n_init=200000, start=None, trace=N
423417
'progressbar': progressbar,
424418
'model': model,
425419
'random_seed': random_seed,
426-
'live_plot': live_plot,
427-
'live_plot_kwargs': live_plot_kwargs,
428420
'cores': cores, }
429421

430422
sample_args.update(kwargs)
@@ -531,13 +523,11 @@ def _sample_population(draws, chain, chains, start, random_seed, step, tune,
531523
latest_traces = None
532524
for it, traces in enumerate(sampling):
533525
latest_traces = traces
534-
# TODO: add support for liveplot during population-sampling
535526
return MultiTrace(latest_traces)
536527

537528

538529
def _sample(chain, progressbar, random_seed, start, draws=None, step=None,
539-
trace=None, tune=None, model=None, live_plot=False,
540-
live_plot_kwargs=None, **kwargs):
530+
trace=None, tune=None, model=None, **kwargs):
541531
skip_first = kwargs.get('skip_first', 0)
542532
refresh_every = kwargs.get('refresh_every', 100)
543533

@@ -548,15 +538,8 @@ def _sample(chain, progressbar, random_seed, start, draws=None, step=None,
548538
try:
549539
strace = None
550540
for it, strace in enumerate(sampling):
551-
if live_plot:
552-
if live_plot_kwargs is None:
553-
live_plot_kwargs = {}
554-
if it >= skip_first:
555-
trace = MultiTrace([strace])
556-
if it == skip_first:
557-
ax = plots.traceplot(trace, live_plot=False, **live_plot_kwargs)
558-
elif (it - skip_first) % refresh_every == 0 or it == draws - 1:
559-
plots.traceplot(trace, ax=ax, live_plot=True, **live_plot_kwargs)
541+
if it >= skip_first:
542+
trace = MultiTrace([strace])
560543
except KeyboardInterrupt:
561544
pass
562545
finally:

0 commit comments

Comments
 (0)