Changelog¶
All notable changes to this project are documented here. The format follows Keep a Changelog, and versions follow Semantic Versioning.
[0.1.0] - 2026-11-29¶
Added¶
Configurable warmed-reference starting width and validated variance references for the 51-dimensional parallax case (#90).
Registered meeting launcher for all benchmark dimensions and mixture variants (#90).
Convergence-gated uncoupled variance references for benchmarks without exact draws (#90).
Complete half-space and quadrant probability reporting for the mixture benchmarks (#90).
Multi-case comparison of frozen random walk and tuned jittered HMC with separate setup and sampling evaluation counts (#90).
Synthetic supernova and parallax benchmarks with independent quadrature references (#90).
Six- and 300-parameter logistic benchmarks with independent Pólya-Gamma reference moments and Monte Carlo standard errors (#90).
Centered normal-means benchmark with one-dimensional quadrature and exact posterior draws at the eight- and hundred-group sizes (#90).
Four-mode benchmark with a curved component and exact quadrant probabilities (#90).
Fixed-replicate coverage, warnings, and cost-normalized variance summaries for the frozen random-walk benchmark (#90).
Evaluation-capped benchmark pilot for the frozen random walk, including raw pair records and censoring-aware meeting-cost quantiles (#90).
Exact synthetic benchmark references for the rotated Gaussian, banana, funnel, and two-mode Gaussian mixture (#90).
Per-replicate random streams keyed by the root seed, a namespace and the replicate index. Each replicate reads its normals and uniforms in order from two child generators, buffered for lockstep batches, so no batch layout or buffer width changes a number.
Warning classes
TelescopicWarning,ConvergenceWarningandInputWarning.Coupling primitives: the reflection-maximal coupling of Gaussians, the rejection maximal coupling with the bounded-variance
etaoption, and the maximal coupling of discrete distributions (telescopic.couplings);telescopic.testing.fixed_drawsto inject random numbers in tests, andtelescopic.testing.random_drawsfor fresh ones.Targetwith a batched interface over scalar or vectorized log-densities and gradients; initial distributionsNormal,Uniform,Empiricalandas_initial.Kernels with their couplings:
RandomWalk(reflection-maximal or maximal proposals),Independencewith aMultivariateTproposal, andMixture. A row’s transition does not depend on the other rows of its batch.The engine (
telescopic.engine.run): replicates of coupled chains in lockstep lanes with refill, exact meeting detection, the lag-\(L\) and thinned estimator weights, signed measures, distances between the chains and censoring. A replicate’s output does not depend on the number of lanes, bitwise for a log-density evaluated point by point. The output records the run’s settings and root seed, whichResultandmergeread.SignedMeasure, the unbiased covariance estimator and quantiles of signed measures by isotonic projection (telescopic.measure,telescopic.estimators).Resultwith estimates and confidence intervals for any test function, unbiased covariances, quantiles, credible intervals and signed histograms; total variation bounds from the meeting times and 1-Wasserstein bounds from the distances between the chains; a summary table; and the warnings of the specification (telescopic.results,telescopic.diagnostics).Automatic tuning and the sampler: adaptive Metropolis pilots whose chains share their adaptation, set the kernels’ unset parameters and warn when they disagree; the choice of
k,mand the lag from pilot meeting times;CoupledSamplerandtelescopic.sample, whose runs warn about the conditions of the specification.Gradient and Gibbs kernels:
MALAandHMC(with a random-walk meeting step) with the reflection-maximal coupling, tuned by dual averaging;Gibbswith maximal, common-random-number and two-scale couplings of user-written conditionals, andTarget(log_prob=None)for kernels that need no log-density. Kernels declare what they evaluate (needs_grad,needs_log_prob) and check a target for it (check_target). A kernel’sstepreturns acceptance probabilities.Parallel runs:
pool=takes a number of worker processes, an executor or a pool withmap, and gives the same replicates as a run in-process, bitwise for a log-density evaluated point by point. The first Ctrl-C lets the replicates in progress finish and returns a result flaggedinterrupted, which the sampler’s next run completes; the second stops at once.progress=shows a tqdm bar or lines on stderr. Theparallelextra installs cloudpickle, which ships functions defined in notebooks to the workers.n_workers=onsampleandCoupledSamplerstates the number of workers of an executor or a pool of your own. A pool that does not report its size, such as a cluster’s, was counted as having as many workers as this process may use CPUs, which left its other workers idle. The argument replaces a reported size, and with a log-density evaluated point by point it changes no replicate.log_prob_and_grad=onsample,CoupledSamplerandTarget, in place ofgrad, takes a function that returns the log-density and its gradient together, such as JAX’svalue_and_grad, and is called once wherelog_probandgradwere called one after the other.log_probis still required, for the evaluations that need no gradient, and a run gives the same numbers and counts as with the two functions when they return the same numbers.A pool’s chunks hold at most 1,024 replicates. Above 4,096 replicates per worker, four chunks per worker grew with the run, to 62,500 replicates each for 1,000,000 on 4 workers; now a worker’s memory, the result it sends back and the steps of the progress bar stay bounded. This process still holds every replicate.
Result.saveandResult.load(a versioned.npzfile, without pickle); joint signed histograms of several coordinates (Result.histogram); plots of meeting times, the TV bound, signed marginals and corner plots (telescopic.plotting, with matplotlib, and theResult.plot_*methods, on new or given axes); example targets with exact moments (telescopic.examples); andtelescopic.testing.check_coupling, which checks a custom kernel’s coupling, its meetings and its cached evaluations.A slow tier of statistical tests (
pytest -m ""): unbiasedness of every kernel family, interval coverage, TV bounds against exact distances, published meeting times and calibration over the prior.benchmarks/run.pytimes the setups of the specification’s performance targets. The tuning pilot runs of order d² steps beyond 20 dimensions, and the variance warning needs one replicate holding more than half the variance; both were measured against their alternatives.import telescopicimports every public submodule butplotting, andprogress=Truedraws tqdm’s text bar, in notebooks too.Result.diagnostics()and the summary report the values behind two warnings, the tail index of the meeting times and the largest share of one replicate in a variance.Documentation: a Start section, how-to guides, six tutorials executed when the site is built, a theory page, the API reference, reference pages and a citing page.
The documentation site is published at https://joshspeagle.com/telescopic/ from each push to
main.The documentation site has its own theme and identity: the Focus mark, two chain colors that mean the two chains, Red Hat type served with the site, light and dark themes, a landing page with a coupled pair drawn by telescopic itself, and navigation by section (Start, Tutorials, How-to guides, Theory, Reference, Project). Every plot of the executed pages shares one style. The design records are no longer built into the site.
Each tutorial has one title in the sidebar, on its page and in the pager, and the comparison with emcee is part of Coming from emcee, under Start. The tutorials are ordered as a learning path, with the failure modes last, and the pager is their only “next” link.
Warnings on the executed pages print as their class and message, without the path of the notebook’s temporary file, and wrap within the column.
Every figure on the executed pages has alternative text and a caption.
A Concepts section explains the method without code, one idea per page with its figures: why a burn-in biases MCMC, two chains that meet, the telescoping correction, signed measures, not samples, error bars from replicates and what replaces R-hat and ESS, and meeting times and the distance to stationarity.
Two Start pages: What telescopic does, without code, says what problem the package solves, what it returns and what it does not do; Is telescopic right for my problem? places a problem among good and poor fits, each with its reason and a link to the page that holds the fact.
Three Reference pages: a Glossary of the package’s terms, linked from each term’s first use on the pages of the other sections but Theory; Notation, which maps each symbol of the theory page to its argument or attribute; and an FAQ whose answers link to the page that holds each fact.
Two how-to guides: Troubleshoot chains that do not meet, indexed by the error or warning a run shows, with its cause, a check in code and the fix, and a chart from each warning to its remedy; and Make a run faster, which gives each lever with its effect, a figure of a replicate’s cost, and a table of times measured by
benchmarks/run_faster.py.A Gallery section of worked examples, executed when the site is built, each ending with its summary, a figure against a known or reference answer, and what its warnings say: the radial-velocity orbit of an exoplanet; a hierarchical model with the three Gibbs couplings; gradients from JAX, for which the
docsdependency group adds JAX; Neal’s funnel, which compares the random walk, HMC and a change of coordinates; and Checking the burn-in of an existing sampler, which couples a Metropolis sampler of one’s own and chooses a burn-in from the total variation bound.Figures on existing pages: the automatic pipeline (Settings), what a
Resultholds, a pool’s chunks and their random streams (Parallel runs), coupled HMC trajectories and a meeting step (Choose a kernel), what the lag andktrade (Choosing k, m and the lag), the estimates of Unbiased on average, telescopic beside emcee, and the two-mode target with its two initial distributions; Write a kernel adds a template of every member a kernel needs and a figure of the marginal check.The API reference is an index of one-line summaries grouped by section, with a page for each class, its attributes and methods, a page for
sample, and a page for each module that the index lists, its functions and a table of its classes. The page of a class with two or more members lists them under “On this page”.The API reference cites no internal requirement or decision numbers; where such a citation carried meaning, it links the page that explains it.
The docstring of
telescopic.sampledescribes each of its parameters, and that ofEstimateitslevel.The docstrings of
sample,CoupledSampler.run,Result.estimate,Result.summary, each kernel class andtesting.check_couplingend with a short example, which the tests run.Every parameter that a docstring lists has a description, and the strict documentation build fails on a parameter that a docstring leaves out of its Parameters section or lists there without a description.
Signatures in the API reference show the parameters’ names and defaults, one per line when long, and the types stay in the docstrings, which state the type of every value that a public method or property returns. The types link to the documentation of telescopic, Python, NumPy and matplotlib.
American spelling throughout the package, its tests and the site, with “Atchadé” spelled one way; codespell checks it in
scripts/verify.sh, CI’s lint job and a pre-commit hook.The Quickstart writes the lag as \(L\) in its equations, defines the pilots and a consistent estimate where it first uses them, and says how to turn on the tail check.
Theory opens with what it derives, writes the algorithm without the meeting time and defines it after, and says what the conditions of unbiasedness ask in practice before stating them.
The kernels guide defines its coupling terms before its table, the result-fields reference says what Hill’s estimate and the Clopper-Pearson bound measure, and the warnings reference when each warning is emitted; the docstring of
diagnostics.hillgives the rule for ties.The guide to choosing an initial distribution links
initial.as_initial, which readsinit.Fixes from an audit of the whole package: a number argument of the wrong type raises
TypeError, and one out of boundsValueError, naming the argument;namesmust be distinct strings, one per coordinate;Kernel.check_ndimchecks a kernel’s dimension; variances are computed about the atoms’ mean; tuning does not depend on the coordinates’ scales; the engine advances up to 256 replicates at a time.Fixes from a second audit: a gradient that is not finite where the log-density is finite is taken as 0 where chains move, which keeps MALA and HMC exact, and raises with the point where they start, where MALA and HMC rejected such proposals and so sampled a restricted target; a run that meets one warns as it does, or when it ends on a pool, and
Result.n_grad_zeroedcounts them; the maximal coupling keeps each chain’s law at draws where a log-density is infinite, and takes SciPy’s Dirichlet laws;check_couplingswaps half the pairs, so that it catches a coupling that reads another row’s state, and fails a NaN p-value;check()and the summary report a slow pair when every pair is censored;hillandvariance_sharecheck their values; every bounded number argument raises “must be in (low, high)”, anddual_averaging, the TV and W1 bounds, the estimators,SignedMeasure.mass,plotting.paths,Target(vectorize=)andpoolcheck what they were missing; a first Ctrl-C after the replicates, while the result is built, no longer loses the run, and a process that ignores Ctrl-C, or whose handler Python did not set, keeps its handler; the tuning pilot takes a third less time at d = 100, Gibbs sweeps less, and joint histograms take memory in proportion to the atoms (SignedMeasure.massis sparse).Changes from a statistical audit against the source papers:
Result.estimatebuilds its interval with the quantile of Student’s t with \(R - 1\) degrees of freedom instead of the normal quantile, whose 95% intervals covered 0.878 at \(R = 5\) on an autoregressive chain, where Student’s t covered 0.950; the stated guarantee of unbiasedness requires that the chain converge from the initial distribution;Gibbs(coupling="crn")uses common random numbers for pairs whose distance underflows to 0, which went to the maximal coupling; and the documentation corrects the meaning of the relative cost and the source of HMC’s target acceptance rate, and describesdiscrete_maximalas serving kernels on finite state spaces, not a built-in kernel.Fixes of run-time defects: a vectorized log-density that returns shape
()for one point, as SciPy’smultivariate_normal.logpdfdoes, or any output that differs from the expected shape only by axes of length 1, is accepted;Targetcopies what its functions return, so one that reuses its output array no longer corrupts states; anIndependenceproposal whoselog_densityis NaN or+infraises with the point instead of biasing the chain; the meeting-time quantiles ofResult.diagnostics()and the summary cover every pair,inf(printed> max_iter) where one falls on a censored pair, and are observed meeting times (the inverted empirical CDF), so they change for runs without censoring too: the 90% quantile of meeting times 1 to 100 is 90, not 90.1, and the median of an even number of pairs is the lower middle value; the summary’s footer hasmax_iter; the survival curve of the meeting times ends at the fraction of pairs censored;sample()refuses fewer than 2 replicates before tuning; aResultwith no replicates, Mixture weights whose sum overflows, a tuned mixture whose components differ in dimension, a kernel that drops its states’ gradients, andcoupling="crn"with conditionals whosemeanandcovare methods raise aValueErrororTypeErrorthat names the cause; MALA’s coupled step no longer warns when its drift overflows.Input validation: an array argument that is not real numbers, such as a string (a numeric one included),
None, a boolean, a complex number or a ragged list, raisesTypeErrornaming the argument and the expected form, where NumPy’s message named neither; real numbers held as objects, such asFraction,Decimalor an object column of pandas, still convert to floats.as_initialraises its ownTypeErrorfor a raggedinit. A flag that is notTrueorFalse(vectorize,progress,strict,store,keep_paths), and anargsthat is not a tuple or a list, raiseTypeErrornaming the argument, and so do a target or a kernel that is not aTargetorKernelinstance, such as a bare log-density passed toengine.runor a kernel class in aMixture.SignedMeasurechecks its arrays:atomsandweightsthat are not real numbers raiseTypeError, and wrong shapes or a replicate index that is not an integer in range raiseValueError. Its attributes are read-only views of the arrays passed in, so they cannot be written through; the arrays passed in, such as those of theReplicatesthatengine.runreturns, stay writable: the package never writes to them, and a user who does changes the measure.unbiased_varianceandunbiased_covarianceof a scalar raiseValueError.CoupledSampler.meeting_timesrefusesmax_iter=None, so the pilot is always capped, andslow_pair_thresholdchecks thatlagis at least 1 andmat least 0.A target function’s output that is not numbers, such as
Noneor a string, at one point among good ones raisesValueErrornaming the function and the point; an emcee(log_prob, blobs)tuple is told that derived quantities come fromResult.estimate. A pointwise function whose outputs differ from point to point only by axes of length 1, such as a float at some points and SciPy’slogpdfof shape(1,)at others, is accepted, and one evaluated on no points returns an empty array. A complex output with an imaginary part of exactly 0 is its real part, and any other complex output raises; floating outputs narrower than float64, as JAX returns by default, emit oneInputWarningper target that names their dtype.When
namesand the initial distribution differ in dimension, the error names the dimension the initial distribution draws; tuning chains whose covariance overflows, on a target flat in some direction or with scales near the float64 limit, raise an error that says so, instead of NumPy’s overflow warnings and “cov must be finite”.Tuning a MALA or HMC step size no longer raises when a pilot chain ends where the gradient is not finite but the log-density is: its dual-averaging chains take that gradient as 0, as runs do wherever chains move.
The package ships a
py.typedmarker, so type checkers such as mypy and pyright read its annotations, and its metadata lists the supported Python versions (3.11 to 3.15), that it runs on any operating system, that it is typed, and a link to its issues.An
Independencechain at a point where the target and the proposal both have zero density, such as a start outside the support of a bounded proposal, accepts any proposal of finite density, as the other Metropolis kernels do; it rejected every proposal, with a NumPyRuntimeWarning.Fixes and checks of a hardening pass, now recorded and tested: a
Mixturenever applies a component of weight 0, which the largest uniforms could select where rounding left the cumulative weights below 1.Gibbs(coupling="crn")refuses a conditional whosemeanis not a vector of its block’s size, where a scalar was added to every coordinate.weighted_quantilerefuses values or weights that are not finite,choose_kmeeting times that are not positive integers orinf,SignedMeasure.massa cell that is not an integer, which it truncated,hillvalues that are not finite, andtesting.random_drawsthe seeds that a run refuses;plot_marginalsandplot_cornercheckbinsand the number of replicates before opening a figure.Result.mergetakes the kernel, initial distribution, tuning report and pilot meeting times of the other result where the first has none. The warning about disagreeing tuning chains also fires where an R-hat is NaN, which hid a disagreement in another coordinate: it names those coordinates, which the pilot never moved in, and reports the largest finite R-hat.The warning that the tuning chains disagree says that the chains may also not have converged, and the documentation of
TuningReport.rhat,tuning_disagreementandCoupledSampler.tunesays that chains that agree do not show that the target has one mode.The documentation states that an automatically tuned
Independenceproposal covers only the modes its tuning chains reached, so a run on well-separated modes can be confidently wrong without a warning; the failure-modes tutorial shows such a run and two checks that help.Independence’sproposalis typed as any object withsampleandlog_density, as it already behaved, so type checkers accept a custom proposal.The documentation states that the default range of
Result.histogrambiases every bin, and thatCouplingReport.passed()fails a correct coupling with probability up to about 4alpha.An
Independenceproposal drawn where the proposal’s ownlog_densityis-inf, such as a draw clipped onto the edge of an open support, is rejected; it was accepted and its chain never left it. The documentation states thatlog_densityis the normalized density of whatsampledraws, positive whereversamplecan land.The Student-\(t\) log-density of
MultivariateTis finite, without a NumPy warning, at points whose squared distance from the mean overflows float64, beyond about 1.34e154 scale units; it was-infthere. This holds for scale matrices above about 1e-307 and a finite offsetx - mean: for a smaller scale matrix the value stays-inf, and where the offset itself overflows it stays NaN, each with a NumPy warning.The documentation states that an
Independenceproposal must be positive wherever the target is: used alone, the kernel never reaches the part of the target’s support that the proposal misses, so the estimates are biased without a warning, and a chain started where the proposal is 0 and the target is not never moves.The documentation states what an
Independenceproposal with lighter tails than the target does: with unbounded weights \(\pi/q\), a run usually gives too little mass to the region where the weights are large, with error bars that are too small and often without a warning; the kernels guide has a measured example.The docstrings of
sample()andCoupledSampler.runsay that their estimates are unbiased unlessmax_itercensors a pair, which biases them, or a Ctrl-C interrupts the run, which leaves them consistent.The warnings about late pairs, a replicate dominating the variance, heavy-tailed meeting times and slow pairs end with the remedy in a few words, as the warning about censored pairs did. A slow pair seen as it happens says that the run waits for it, and for a replicate that a first Ctrl-C lets it finish. The warning about tuning chains that disagree advises an initial distribution that covers every mode only unless the one given already does.
Result.diagnostics()reportsvariance_share_replicate, the index of the replicate that holds the largest share of the variance of an estimate, and the variance warning names it.A replicate or pilot pair that starts where the target density is zero is reported as soon as it starts, in this process, instead of when the run ends; the slow-pair warning of such a pair says so, the censoring warning no longer suggests running without a cap after such starts, and a pilot that cannot choose
knames them instead of advising a wider initial distribution.engine.Statuscarries the number of replicates started at zero density so far, the first of them, and whether the slowest pair is one of them.The memory warning compares the estimated peak of a run and its first estimates, about three times the stored atoms and distances, with its threshold of 1 GB, and states both figures, with twice the peak as its upper end in one or two dimensions, where few repeated atoms can make the estimates take up to about five times the stored size;
telescopic.engine.stored_bytescomputes the stored size, and refuses steps that are not non-negative integers.progress=Truealso shows the progress of tuning: the steps of the adaptive pilot chains and, for MALA and HMC, of the step size’s dual averaging.Changes to
Resultruled before the first release: the last bin of a histogram is closed, as innumpy.histogram, so an atom on the upper edge ofrangeis counted, and the last edge of the default range is no longer nudged up; the TV bound and its value atkcount a censored pair as meeting at its cap plus 1, since its chains were compared at the cap, which raises the bound by \(1/R\) per censored pair at each \(t \le\) cap \(- L\) where \(L\) divides cap \(- L - t\), andtelescopic.diagnostics.tv_boundasks for a censored pair as its cap plus 1;Result.intervalis renamedResult.credible_interval, with no alias, andEstimate.intervalis an array of shape(2,)or(2, p), lower ends first, instead of a tuple of two arrays;Result.quantileandResult.credible_intervaltake a functionh, asestimatedoes, for the quantiles of a derived quantity; aResultprints as one line of its settings, such asResult(R=100, d=2, k=63, m=630, lag=63, censored=0, interrupted=False).A pair censored at a
max_iterequal to the slow-pair threshold now raises the slow-pair warning, since its chains were compared, unmet, at the threshold.The summary shows as an HTML table in notebooks, its footer a list with one warning per item. Its text keeps the lines below the table within 80 characters, with the kernel on a line of its own and its floating-point parameters to 4 significant figures, and sizes each column of the table to its entries.
plotting.pathsdraws \(X\) in magenta and \(Y\) in teal, the documentation’s chain colors, and a pair in the dark ink of met chains from its meeting time on; the colors areplotting.CHAIN_X,CHAIN_YandMET. A legend says which line is which, and in one dimension the time axis has integer ticks.The pool of worker processes that telescopic starts, with the semaphores of its stop event, is freed when the caller drops an error raised in a worker. A reference cycle held them until a later garbage collection, which on Python 3.11 and 3.12 can warn that the resource tracker was called reentrantly and leave the semaphores to leak.
Each public module of the package lists in
__all__the names that the API reference documents, so a star import fromtelescopic.diagnostics, for example, andhelp()on it no longer list the helpers that the module imports.A sampler built with
gradand a kernel that evaluates it comparesgradwith central differences oflog_probalong 8 lines through draws of the initial distribution, before tuning, and emits anInputWarningwith the size of the disagreement in nats where they disagree beyond rounding, or when it could compare no line. It costs 40 evaluations oflog_proband 8 ofgradat any dimension for float64 values, and 48 draws of the initial distribution, draws from a random stream of its own and changes no result;check_grad=FalseonCoupledSamplerandsampleturns it off, andCoupledSampler.gradient_check, adiagnostics.GradientCheck, records what it compared. An error raised inside the check keeps its type and message, with a note that it was raised in the check.Gibbs(coupling="crn")draws a block of several coordinates, or of one withoutppf, from each chain’s own conditional with generators in the same state, so each chain keeps its conditional’s law; a pair of chains takes a common uniform or these generators by its own two conditionals, so a replicate’s output does not depend on the other replicates in its batch. It took such a conditional to be the normal with itsmeanandcov, which gave a conditional that is not normal the wrong law in the coupled step only, and it refused conditionals without ameanand acovthat are values, such as SciPy’s frozendirichlet, whosemeanandcovare methods,wishart, which has nocov, andmultivariate_t, which has neither. Blocks of one coordinate withppf, and the maximal coupling, give the same numbers as before.Draws.child(row)returns a new child of a row’s generator, which does not move the row’s stream: two draws from it can read the same numbers, as the Gibbs kernel’s common random numbers do.A request of
Drawsfor no rows returns an empty array. It raisedValueErrorwhen it asked for at least two numbers per row more than the buffer held, as for two normals per row of replayed draws without normals.import telescopicno longer importsscipy.stats,scipy.optimizeandscipy.integrate: the functions that use them import them at their first call. That shortens the import, and with it the start of each worker of a process pool; the first call that needsscipy.stats, such as the end of the first run ofsample, pays its import once.Result.covweights the atoms in blocks of 1 MiB, so its peak memory is about the atoms’ size plus a block rather than twice the atoms;covcan differ from before in the last bits.Result.quantilegathers one coordinate at a time instead of copying the atoms, which lowers its peak memory.Result.var,Result.stdand the diagnostics share each replicate’s moments, computed once, sosummary()centers the atoms once;varandstdcan differ from before in the last bits.SignedMeasurerequiresreplicatein nondecreasing order, each replicate’s atoms consecutive, and raisesValueErrorotherwise; its sums share the weights and hold 8 bytes per atom fewer.With a vectorized target (
vectorize=True), RandomWalk, MALA, HMC and the tuning pilot compute their products of a batch of chains with a matrix by BLAS: whole runs of 256 replicates on a Gaussian of 200 dimensions took 2.1 times less processor time with RandomWalk, whose pairs all ran to the iteration cap, and 3.4 times less with MALA. Such a run repeats bitwise only with the same seed and settings,poolandn_workers, BLAS build and number of BLAS threads; runs of other lane counts, pools, merges and later calls of a sampler, and runs on workers, which use one BLAS thread, against runs in a process with more, can differ by rounding, which can move a replicate’s meeting time and its whole output, while the estimates agree within their error bars. Seeded outputs of vectorized runs change likewise. A target evaluated point by point keeps every bitwise guarantee.couplings.reflection_maximaltakesblas=Trueto do the same.The guide “Check and set a step size” names a resonance of HMC’s leapfrog on Gaussians, on which a given
n_steps, or a givencovthat does not whiten the target, can put the automatic step. With MALA or HMC, the error raised whenkcannot be chosen carries a note that points to it.The documentation’s pages are split by task. Start holds Install, the Quickstart and Coming from emcee; Unbiased on average is the second tutorial; the how-to guides write the log-density, choose an initial distribution, a kernel and a step size, set the run’s arguments, estimate, plot, save, load and merge, read meeting times, run in parallel and write a kernel; Reference adds the fields of a result and the warnings. The addresses
getting-started,tutorials/beside-emcee,guide/targets,guide/resultsandguide/diagnosticsare gone.couplings.reflection_maximal, which the coupled steps of RandomWalk, MALA and HMC call, reflects with one product with the covariance factor instead of two: a call at 256 rows took 1.08 to 1.38 times less time at d = 2 to 200. Seeded outputs of their coupled runs change: in the last bits for RandomWalk and MALA used alone; for kernels whose chains come close without meeting, such as HMC or aMixturewith a contracting component, a meeting time can move, and with it a replicate’s estimates (one of 100 on a logistic regression of 6 dimensions with HMC, which moved the estimates by up to 0.075 standard errors).MALAcomputes its step and coupled step in whitened coordinates: 3 products of a row with a \(d \times d\) factor per step and 7 per coupled step, against 7 and 14. A single step took 0.66 to 0.76 times the time at d = 100 and 200, and a coupled step 0.80 to 0.82 times at d = 100 (medians of four benchmark runs on a dense vectorized target, with the form as prototyped). It is the same kernel; seeded outputs of runs that step MALA change in the last bits.The tuning pilot draws its normals and uniforms 256 steps at a time instead of at every step, which made it 1.24 to 1.32 times faster on a Gaussian target at d = 2 to 100. Its outputs are unchanged.
Independencecomputes its weights with fewer operations per step, and a Student-tMultivariateTits normalizing constant once: a one-lane run with a Student-t proposal at d = 20 took 1.12 times less time. Its outputs are unchanged.A request for random numbers takes less time: on a nearly free target at d = 2, the time in requests per step of dual averaging (4 chains), or of the engine or a kernel at one lane, fell by 5 to 17 µs, about a third, in every run. The median time of a whole step was 0.89 to 0.95 times as long, but single runs ranged from 0.79 to 1.35 times; at 256 lanes no change was measured. Outputs are unchanged.
CoupledSampler.resume(result)continues a returned, loaded or merged result on a new sampler: it adopts the result’s seed, replicates, settings, pilot and tuning, and the nextruncompletes the replicates an interrupted run never started, then continues above the highest index requested. It checks the dimension, the kernel’s class, anrnggiven to the constructor and the names; the target and the kernel’s parameters are the caller’s to match. An untuned kernel, as a loaded result needs, is tuned again from the result’s seed; anInputWarningsays when the kernel’s tuning or description differs from the result’s.Proposal and coupling objects:
kernels.MetropolisHastings(proposal, coupling)with the proposalsRandomWalkProposal,LangevinProposalandIndependenceProposal, and the couplingscouplings.Reflection,couplings.Maximalandcouplings.Shared, each of which supports only the proposals it was published for.RandomWalk,MALAandIndependenceare built on them, and their seeded outputs are unchanged bit for bit.RandomWalk(coupling=...)also takesReflection()orMaximal();RandomWalk.couplingandIndependence.proposalcan no longer be reassigned.An error during the replicates, such as one of the log-density, no longer loses the replicates finished before it. The same exception is raised again with one note:
engine.runattaches the finished replicates astelescopic_replicates, andCoupledSampler.runandsamplekeep them and attach the result of all the sampler’s replicates astelescopic_result, whose nextrun, orresume, starts with the missing ones. The replicates in progress at the error are listed inReplicates.abandonedandResult.abandoned, saved, and named in the summary until they run. On a pool the error stops the run as a first Ctrl-C does; an error that does not unpickle becomes aRuntimeErrorwith the worker’s traceback in a note, instead of breaking a process pool.Each atom records the time at which it was recorded,
Replicates.time(int32), andResult.chains()returns the averaged states of each kept replicate as chains of equal length.max_itermust be at most 2**31 - 1 where times are stored, and a stored atom costs 8d + 20 bytes instead of 8d + 16.Result.to_datatree()returns the chains ofResult.chains()as ArviZ data, one variable per parameter name with the replicate indices and times as coordinates, as anxarray.DataTree; it needs ArviZ 1.0 or newer, which needs Python 3.12 and NumPy 2, through the new extratelescopic[arviz].keeponCoupledSampler.run,sampleandengine.run(andengine.Settings.keep) stores the signed measures and distances of the replicates of index belowkeeponly, and the moments of every replicate (Replicates.centerandReplicates.moments), from whichmean,var,stdandcov(up to 100 dimensions) come;estimate, the quantiles, the histograms and their plots come from then_keptkept replicates (Result.keep,Result.n_kept), and the summary and the repr name the replicates behind each figure. The memory warning counts the moments.The variance share of the diagnostics takes each replicate’s second moments about the mean estimate instead of the atoms’ mean, which changes its values.
Results are saved in schema 2, which names the estimator family and keeps
keep, the times, the moments and the abandoned replicates; files of schema 1 load with their times rebuilt.HMCjitters its step by default: each trajectory takes a step drawn uniformly between(1 - jitter)and(1 + jitter)timesstep_size, the same for both chains of a pair, withn_stepsfixed bystep_size, and the automatic step is tuned on the jittered kernel. The new argumentjitter, in [0, 1), is 0.5 by default and shown in the repr;jitter=0gives the fixed-step kernel, bit for bit. The jitter keeps the step off the leapfrog’s resonance: on the Gaussians where a givenn_steps, or a givencovthat does not whiten the target, left pilot pairs unmet,kis chosen. Every seeded output ofHMCwith the default changes, and the note on the error raised whenkcannot be chosen now suggests the default jitter for HMC withjitter=0.Statehas a fourth field,extra: arrays of one kernel, batch first, such as a momentum or a cache. A kernel names its Markov fields inKernel.markov_fieldsand gives their initial values inKernel.init_extra, whichinit_stateattaches and checks for every Markov field; a pair meets when its positions and Markov fields are equal. Kernels,State.take,State.putandMixturecarry unchanged the fields they do not know, aMixturenames componenti’s fields"i/<name>"and refuses components with Markov fields, andcheck_couplingcounts meetings on the Markov state and counts as stale the chains whose caches change their next step. No shipped kernel has such fields, and every seeded output is unchanged. Code that unpacksdataclasses.astuple(state)into three names breaks.Independencekeeps log q at each chain’s position in the chain’s state, with the point at which it was computed, and uses it only where that point is the position bit for bit: a step and a coupled step evaluate the proposal’slog_densityat the proposals and at the states without a valid value, usually n rows where they were 2n and 3n, and withMultivariateTevery seeded output is unchanged.Proposal.init_extragives a proposal’s own fields.A
widewarning when the tuning pilot shows an initial distribution more than 30 times wider than the target, emitted when tuning runs and listed bycheckunless the run’skexceeds the pilot rule’s:TuningReport.initial_widthandPilotRun.initial_widthhold the geometric mean over coordinates of the ratio of the standard deviations of the initial draws to the pilot’s,PilotRun.initial_varthe draws’ variances, anddiagnostics.wide_startwords the warning. The guide on settings shows a confirmation round of pilot pairs at lagkas an option.plotting.survival(meeting_times, lag, ax=None, *, max_iter=None, label=None)draws the survival function of an array of meeting times, such asCoupledSampler.meeting_timesreturns, into a given axis, so that several runs share one; a censored pair (inf) counts up tomax_iter, as inplotting.meeting_times, which now draws its curve with it.Result.mergetakes any number of results,a.merge(b, c, d), and joins them in one pass.CoupledSampler.run(n, start=i)runs the replicates of indicesitoi + n - 1, so that separate samplers with one seed and the same settings run the ranges of one run.Checkpoints:
sample(..., checkpoint=directory)andCoupledSampler.run(..., checkpoint=directory)write the run’s plan (seed, settings, tuning report, pilot and the version of telescopic) and then its replicates as they finish, every 256 in this process and each chunk on a pool, each file renamed into place once whole. The same call, with the samerng, adopts the directory’s plan, reads the replicates of its call stored there and runs the others, so it completes a run whose process was killed.CoupledSampler.plan(n, ...)fixes the settings without running replicates and writes them as a plan ofnreplicates, for the tasks of a cluster job, which run their ranges withstart, also onsample;Result.load(directory)merges every replicate a checkpoint holds, and warns when tasks tuned their kernel differently from the plan, as on another type of CPU.
Changed¶
diagnostics.tv_bound,diagnostics.w1_bound,Result.tv_boundandResult.w1_boundreturn the pair(bound, standard_error), the standard error being that of the average over replicates of each pair’s term; the bounds are unchanged, bit for bit.diagnostics.w1_boundtakesdistance_ownerfirst, asengine.Replicatesholds it, since the error needs each record’s replicate.plot_tv_bounddraws a band of two standard errors. Code that used the single array, or the former arguments ofdiagnostics.w1_bound, breaks.