Skip to content

Commit

Permalink
Deploying to gh-pages from @ e0f107f 🚀
Browse files Browse the repository at this point in the history
  • Loading branch information
junpenglao committed Nov 27, 2023
1 parent bc9da68 commit 2b422b3
Show file tree
Hide file tree
Showing 53 changed files with 485 additions and 342 deletions.
Binary file modified .doctrees/autoapi/blackjax/mcmc/integrators/index.doctree
Binary file not shown.
Binary file modified .doctrees/autoapi/blackjax/util/index.doctree
Binary file not shown.
Binary file modified .doctrees/bib.doctree
Binary file not shown.
Binary file modified .doctrees/environment.pickle
Binary file not shown.
Binary file modified .doctrees/examples/howto_custom_gradients.doctree
Binary file not shown.
Binary file modified .doctrees/examples/howto_metropolis_within_gibbs.doctree
Binary file not shown.
Binary file modified .doctrees/examples/howto_other_frameworks.doctree
Binary file not shown.
Binary file modified .doctrees/examples/howto_sample_multiple_chains.doctree
Binary file not shown.
Binary file modified .doctrees/examples/howto_use_aesara.doctree
Binary file not shown.
Binary file modified .doctrees/examples/howto_use_numpyro.doctree
Binary file not shown.
Binary file modified .doctrees/examples/howto_use_oryx.doctree
Binary file not shown.
Binary file modified .doctrees/examples/howto_use_pymc.doctree
Binary file not shown.
Binary file modified .doctrees/examples/howto_use_tfp.doctree
Binary file not shown.
Binary file modified .doctrees/examples/quickstart.doctree
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
4 changes: 2 additions & 2 deletions _modules/blackjax/_version.html
Original file line number Diff line number Diff line change
Expand Up @@ -350,8 +350,8 @@ <h1>Source code for blackjax._version</h1><div class="highlight"><pre>
<span class="n">__version_tuple__</span><span class="p">:</span> <span class="n">VERSION_TUPLE</span>
<div class="viewcode-block" id="version_tuple"><a class="viewcode-back" href="../../autoapi/blackjax/_version/index.html#blackjax._version.version_tuple">[docs]</a><span class="n">version_tuple</span><span class="p">:</span> <span class="n">VERSION_TUPLE</span></div>

<span class="n">__version__</span> <span class="o">=</span> <span class="n">version</span> <span class="o">=</span> <span class="s1">&#39;0.1.dev1+g16df9a6&#39;</span>
<span class="n">__version_tuple__</span> <span class="o">=</span> <span class="n">version_tuple</span> <span class="o">=</span> <span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="s1">&#39;dev1&#39;</span><span class="p">,</span> <span class="s1">&#39;g16df9a6&#39;</span><span class="p">)</span>
<span class="n">__version__</span> <span class="o">=</span> <span class="n">version</span> <span class="o">=</span> <span class="s1">&#39;0.1.dev1+ge0f107f&#39;</span>
<span class="n">__version_tuple__</span> <span class="o">=</span> <span class="n">version_tuple</span> <span class="o">=</span> <span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="s1">&#39;dev1&#39;</span><span class="p">,</span> <span class="s1">&#39;ge0f107f&#39;</span><span class="p">)</span>
</pre></div>

</article>
Expand Down
467 changes: 294 additions & 173 deletions _modules/blackjax/mcmc/integrators.html

Large diffs are not rendered by default.

22 changes: 22 additions & 0 deletions _modules/blackjax/util.html
Original file line number Diff line number Diff line change
Expand Up @@ -420,6 +420,28 @@ <h1>Source code for blackjax.util</h1><div class="highlight"><pre>
<span class="k">return</span> <span class="n">unravel_fn</span><span class="p">(</span><span class="n">mu</span> <span class="o">+</span> <span class="n">linear_map</span><span class="p">(</span><span class="n">sigma</span><span class="p">,</span> <span class="n">sample</span><span class="p">))</span></div>


<div class="viewcode-block" id="generate_unit_vector"><a class="viewcode-back" href="../../autoapi/blackjax/util/index.html#blackjax.util.generate_unit_vector">[docs]</a><span class="k">def</span> <span class="nf">generate_unit_vector</span><span class="p">(</span>
<span class="n">rng_key</span><span class="p">:</span> <span class="n">PRNGKey</span><span class="p">,</span>
<span class="n">position</span><span class="p">:</span> <span class="n">ArrayLikeTree</span><span class="p">,</span>
<span class="p">)</span> <span class="o">-&gt;</span> <span class="n">Array</span><span class="p">:</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;Generate a random unit vector with output structure that match a given PyTree.</span>

<span class="sd"> Parameters</span>
<span class="sd"> ----------</span>
<span class="sd"> rng_key:</span>
<span class="sd"> The pseudo-random number generator key used to generate random numbers.</span>
<span class="sd"> position:</span>
<span class="sd"> PyTree that the structure the output should to match.</span>

<span class="sd"> Returns</span>
<span class="sd"> -------</span>
<span class="sd"> Random unit vector that match the structure of position.</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="n">p</span><span class="p">,</span> <span class="n">unravel_fn</span> <span class="o">=</span> <span class="n">ravel_pytree</span><span class="p">(</span><span class="n">position</span><span class="p">)</span>
<span class="n">sample</span> <span class="o">=</span> <span class="n">normal</span><span class="p">(</span><span class="n">rng_key</span><span class="p">,</span> <span class="n">shape</span><span class="o">=</span><span class="n">p</span><span class="o">.</span><span class="n">shape</span><span class="p">,</span> <span class="n">dtype</span><span class="o">=</span><span class="n">p</span><span class="o">.</span><span class="n">dtype</span><span class="p">)</span>
<span class="k">return</span> <span class="n">unravel_fn</span><span class="p">(</span><span class="n">sample</span> <span class="o">/</span> <span class="n">jnp</span><span class="o">.</span><span class="n">linalg</span><span class="o">.</span><span class="n">norm</span><span class="p">(</span><span class="n">sample</span><span class="p">))</span></div>


<div class="viewcode-block" id="pytree_size"><a class="viewcode-back" href="../../autoapi/blackjax/util/index.html#blackjax.util.pytree_size">[docs]</a><span class="k">def</span> <span class="nf">pytree_size</span><span class="p">(</span><span class="n">pytree</span><span class="p">:</span> <span class="n">ArrayLikeTree</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">int</span><span class="p">:</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;Return the dimension of the flatten PyTree.&quot;&quot;&quot;</span>
<span class="k">return</span> <span class="nb">sum</span><span class="p">(</span><span class="n">jnp</span><span class="o">.</span><span class="n">size</span><span class="p">(</span><span class="n">value</span><span class="p">)</span> <span class="k">for</span> <span class="n">value</span> <span class="ow">in</span> <span class="n">tree_leaves</span><span class="p">(</span><span class="n">pytree</span><span class="p">))</span></div>
Expand Down
61 changes: 21 additions & 40 deletions _sources/autoapi/blackjax/mcmc/integrators/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,60 +12,41 @@
Module Contents
---------------


Functions
~~~~~~~~~

.. autoapisummary::

blackjax.mcmc.integrators.velocity_verlet
blackjax.mcmc.integrators.mclachlan
blackjax.mcmc.integrators.yoshida



.. py:function:: velocity_verlet(logdensity_fn: Callable, kinetic_energy_fn: blackjax.mcmc.metrics.EuclideanKineticEnergy) -> Integrator
The velocity Verlet (or Verlet-Störmer) integrator.

The velocity Verlet is a two-stage palindromic integrator :cite:p:`bou2018geometric` of the form
(a1, b1, a2, b1, a1) with a1 = 0. It is numerically stable for values of
the step size that range between 0 and 2 (when the mass matrix is the
identity).

While the position (a1 = 0.5) and velocity Verlet are the most commonly used
in samplers, it is known in the numerical computation literature that the value
$a1 pprox 0.1932$ leads to a lower integration error :cite:p:`mclachlan1995numerical,schlick2010molecular`. The authors of :cite:p:`bou2018geometric`
show that the value $a1 pprox 0.21132$ leads to an even higher step acceptance
rate, up to 3 times higher than with the standard position verlet (p.22, Fig.4).

By choosing the velocity verlet we avoid two computations of the gradient
of the kinetic energy. We are trading accuracy in exchange, and it is not
clear whether this is the right tradeoff.



.. py:function:: mclachlan(logdensity_fn: Callable, kinetic_energy_fn: Callable) -> Integrator
.. py:data:: velocity_verlet
Two-stage palindromic symplectic integrator derived in :cite:p:`blanes2014numerical`.

The integrator is of the form (b1, a1, b2, a1, b1). The choice of the parameters
determine both the bound on the integration error and the stability of the
method with respect to the value of `step_size`. The values used here are
the ones derived in :cite:p:`mclachlan1995numerical`; note that :cite:p:`blanes2014numerical` is more focused on stability
and derives different values.
the ones derived in :cite:p:`mclachlan1995numerical`; note that :cite:p:`blanes2014numerical`
is more focused on stability and derives different values.

Also known as the minimal norm integrator.


.. py:function:: yoshida(logdensity_fn: Callable, kinetic_energy_fn: Callable) -> Integrator
.. py:data:: mclachlan
Three stages palindromic symplectic integrator derived in :cite:p:`mclachlan1995numerical`

The integrator is of the form (b1, a1, b2, a2, b2, a1, b1). The choice of
the parameters determine both the bound on the integration error and the
stability of the method with respect to the value of `step_size`. The
values used here are the ones derived in :cite:p:`mclachlan1995numerical` which guarantees a stability
interval length approximately equal to 4.67.
values used here are the ones derived in :cite:p:`mclachlan1995numerical` which
guarantees a stability interval length approximately equal to 4.67.

.. py:data:: yoshida
.. py:data:: noneuclidean_leapfrog
.. py:data:: noneuclidean_mclachlan
.. py:data:: noneuclidean_yoshida
11 changes: 11 additions & 0 deletions _sources/autoapi/blackjax/util/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ Functions

blackjax.util.linear_map
blackjax.util.generate_gaussian_noise
blackjax.util.generate_unit_vector
blackjax.util.pytree_size
blackjax.util.index_pytree

Expand Down Expand Up @@ -63,6 +64,16 @@ Functions
:rtype: Gaussian noise following N(mu, sigma) that match the structure of position.


.. py:function:: generate_unit_vector(rng_key: blackjax.types.PRNGKey, position: blackjax.types.ArrayLikeTree) -> blackjax.types.Array
Generate a random unit vector with output structure that match a given PyTree.

:param rng_key: The pseudo-random number generator key used to generate random numbers.
:param position: PyTree that the structure the output should to match.

:rtype: Random unit vector that match the structure of position.


.. py:function:: pytree_size(pytree: blackjax.types.ArrayLikeTree) -> int
Return the dimension of the flatten PyTree.
Expand Down
Loading

0 comments on commit 2b422b3

Please sign in to comment.