Skip to content

Commit 1383860

Browse files
committed
Bumping version and regenerating HTML docs
1 parent 95db0f5 commit 1383860

17 files changed

Lines changed: 725 additions & 456 deletions

docs/docs/adapters.html

Lines changed: 31 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ <h1 class="title">Module <code>mici.adapters</code></h1>
102102
<details class="source">
103103
<summary>
104104
<span>Expand source code</span>
105-
<a href="https://github.com/matt-graham/mici/blob/056095624298b0e017652794677e9ba43f7f5ed8/mici/adapters.py#L0-L475" class="git-link">Browse git</a>
105+
<a href="https://github.com/matt-graham/mici/blob/aaaad1aae5ce2d12baf95e59bc5ade40149c397b/mici/adapters.py#L0-L478" class="git-link">Browse git</a>
106106
</summary>
107107
<pre><code class="python">&#34;&#34;&#34;Methods for adaptively setting algorithmic parameters of transitions.&#34;&#34;&#34;
108108

@@ -276,7 +276,7 @@ <h1 class="title">Module <code>mici.adapters</code></h1>
276276
}
277277
init_step_size = (
278278
self._find_and_set_init_step_size(chain_state, system, integrator)
279-
if integrator.step_size is None else integrator.step_size)
279+
)
280280
if self.log_step_size_reg_target is None:
281281
adapt_state[&#39;log_step_size_reg_target&#39;] = log(10 * init_step_size)
282282
else:
@@ -317,14 +317,17 @@ <h1 class="title">Module <code>mici.adapters</code></h1>
317317
&#34;&#34;&#34;
318318
init_state = state.copy()
319319
h_init = system.h(init_state)
320+
if np.isnan(h_init):
321+
raise AdaptationError(&#39;Hamiltonian evaluating to NaN at initial state.&#39;)
320322
integrator.step_size = 1
321323
delta_h_threshold = log(2)
322324
for s in range(self.max_init_step_size_iters):
323325
try:
324326
state = integrator.step(init_state)
325327
delta_h = abs(h_init - system.h(state))
326-
if s == 0:
327-
step_size_too_big = delta_h &gt; delta_h_threshold
328+
if s == 0 or np.isnan(delta_h):
329+
step_size_too_big = (
330+
np.isnan(delta_h) or delta_h &gt; delta_h_threshold)
328331
if (step_size_too_big and delta_h &lt;= delta_h_threshold) or (
329332
not step_size_too_big and delta_h &gt; delta_h_threshold):
330333
return integrator.step_size
@@ -606,7 +609,7 @@ <h2 class="section-title" id="header-classes">Classes</h2>
606609
<details class="source">
607610
<summary>
608611
<span>Expand source code</span>
609-
<a href="https://github.com/matt-graham/mici/blob/056095624298b0e017652794677e9ba43f7f5ed8/mici/adapters.py#L11-L85" class="git-link">Browse git</a>
612+
<a href="https://github.com/matt-graham/mici/blob/aaaad1aae5ce2d12baf95e59bc5ade40149c397b/mici/adapters.py#L11-L85" class="git-link">Browse git</a>
610613
</summary>
611614
<pre><code class="python">class Adapter(ABC):
612615
&#34;&#34;&#34;Abstract adapter for implementing schemes to adapt transition parameters.
@@ -706,7 +709,7 @@ <h3>Instance variables</h3>
706709
<details class="source">
707710
<summary>
708711
<span>Expand source code</span>
709-
<a href="https://github.com/matt-graham/mici/blob/056095624298b0e017652794677e9ba43f7f5ed8/mici/adapters.py#L76-L85" class="git-link">Browse git</a>
712+
<a href="https://github.com/matt-graham/mici/blob/aaaad1aae5ce2d12baf95e59bc5ade40149c397b/mici/adapters.py#L76-L85" class="git-link">Browse git</a>
710713
</summary>
711714
<pre><code class="python">@property
712715
@abstractmethod
@@ -747,7 +750,7 @@ <h2 id="returns">Returns</h2>
747750
<details class="source">
748751
<summary>
749752
<span>Expand source code</span>
750-
<a href="https://github.com/matt-graham/mici/blob/056095624298b0e017652794677e9ba43f7f5ed8/mici/adapters.py#L22-L36" class="git-link">Browse git</a>
753+
<a href="https://github.com/matt-graham/mici/blob/aaaad1aae5ce2d12baf95e59bc5ade40149c397b/mici/adapters.py#L22-L36" class="git-link">Browse git</a>
751754
</summary>
752755
<pre><code class="python">@abstractmethod
753756
def initialize(self, chain_state, transition):
@@ -793,7 +796,7 @@ <h2 id="args">Args</h2>
793796
<details class="source">
794797
<summary>
795798
<span>Expand source code</span>
796-
<a href="https://github.com/matt-graham/mici/blob/056095624298b0e017652794677e9ba43f7f5ed8/mici/adapters.py#L38-L55" class="git-link">Browse git</a>
799+
<a href="https://github.com/matt-graham/mici/blob/aaaad1aae5ce2d12baf95e59bc5ade40149c397b/mici/adapters.py#L38-L55" class="git-link">Browse git</a>
797800
</summary>
798801
<pre><code class="python">@abstractmethod
799802
def update(self, adapt_state, chain_state, trans_stats, transition):
@@ -839,7 +842,7 @@ <h2 id="args">Args</h2>
839842
<details class="source">
840843
<summary>
841844
<span>Expand source code</span>
842-
<a href="https://github.com/matt-graham/mici/blob/056095624298b0e017652794677e9ba43f7f5ed8/mici/adapters.py#L57-L74" class="git-link">Browse git</a>
845+
<a href="https://github.com/matt-graham/mici/blob/aaaad1aae5ce2d12baf95e59bc5ade40149c397b/mici/adapters.py#L57-L74" class="git-link">Browse git</a>
843846
</summary>
844847
<pre><code class="python">@abstractmethod
845848
def finalize(self, adapt_state, transition):
@@ -932,7 +935,7 @@ <h2 id="args">Args</h2>
932935
<details class="source">
933936
<summary>
934937
<span>Expand source code</span>
935-
<a href="https://github.com/matt-graham/mici/blob/056095624298b0e017652794677e9ba43f7f5ed8/mici/adapters.py#L88-L263" class="git-link">Browse git</a>
938+
<a href="https://github.com/matt-graham/mici/blob/aaaad1aae5ce2d12baf95e59bc5ade40149c397b/mici/adapters.py#L88-L266" class="git-link">Browse git</a>
936939
</summary>
937940
<pre><code class="python">class DualAveragingStepSizeAdapter(Adapter):
938941
&#34;&#34;&#34;Dual averaging integrator step size adapter.
@@ -1019,7 +1022,7 @@ <h2 id="args">Args</h2>
10191022
}
10201023
init_step_size = (
10211024
self._find_and_set_init_step_size(chain_state, system, integrator)
1022-
if integrator.step_size is None else integrator.step_size)
1025+
)
10231026
if self.log_step_size_reg_target is None:
10241027
adapt_state[&#39;log_step_size_reg_target&#39;] = log(10 * init_step_size)
10251028
else:
@@ -1060,14 +1063,17 @@ <h2 id="args">Args</h2>
10601063
&#34;&#34;&#34;
10611064
init_state = state.copy()
10621065
h_init = system.h(init_state)
1066+
if np.isnan(h_init):
1067+
raise AdaptationError(&#39;Hamiltonian evaluating to NaN at initial state.&#39;)
10631068
integrator.step_size = 1
10641069
delta_h_threshold = log(2)
10651070
for s in range(self.max_init_step_size_iters):
10661071
try:
10671072
state = integrator.step(init_state)
10681073
delta_h = abs(h_init - system.h(state))
1069-
if s == 0:
1070-
step_size_too_big = delta_h &gt; delta_h_threshold
1074+
if s == 0 or np.isnan(delta_h):
1075+
step_size_too_big = (
1076+
np.isnan(delta_h) or delta_h &gt; delta_h_threshold)
10711077
if (step_size_too_big and delta_h &lt;= delta_h_threshold) or (
10721078
not step_size_too_big and delta_h &gt; delta_h_threshold):
10731079
return integrator.step_size
@@ -1152,7 +1158,7 @@ <h2 id="returns">Returns</h2>
11521158
<details class="source">
11531159
<summary>
11541160
<span>Expand source code</span>
1155-
<a href="https://github.com/matt-graham/mici/blob/056095624298b0e017652794677e9ba43f7f5ed8/mici/adapters.py#L163-L179" class="git-link">Browse git</a>
1161+
<a href="https://github.com/matt-graham/mici/blob/aaaad1aae5ce2d12baf95e59bc5ade40149c397b/mici/adapters.py#L163-L179" class="git-link">Browse git</a>
11561162
</summary>
11571163
<pre><code class="python">def initialize(self, chain_state, transition):
11581164
integrator = transition.integrator
@@ -1164,7 +1170,7 @@ <h2 id="returns">Returns</h2>
11641170
}
11651171
init_step_size = (
11661172
self._find_and_set_init_step_size(chain_state, system, integrator)
1167-
if integrator.step_size is None else integrator.step_size)
1173+
)
11681174
if self.log_step_size_reg_target is None:
11691175
adapt_state[&#39;log_step_size_reg_target&#39;] = log(10 * init_step_size)
11701176
else:
@@ -1200,7 +1206,7 @@ <h2 id="args">Args</h2>
12001206
<details class="source">
12011207
<summary>
12021208
<span>Expand source code</span>
1203-
<a href="https://github.com/matt-graham/mici/blob/056095624298b0e017652794677e9ba43f7f5ed8/mici/adapters.py#L241-L254" class="git-link">Browse git</a>
1209+
<a href="https://github.com/matt-graham/mici/blob/aaaad1aae5ce2d12baf95e59bc5ade40149c397b/mici/adapters.py#L244-L257" class="git-link">Browse git</a>
12041210
</summary>
12051211
<pre><code class="python">def update(self, adapt_state, chain_state, trans_stats, transition):
12061212
adapt_state[&#39;iter&#39;] += 1
@@ -1242,7 +1248,7 @@ <h2 id="args">Args</h2>
12421248
<details class="source">
12431249
<summary>
12441250
<span>Expand source code</span>
1245-
<a href="https://github.com/matt-graham/mici/blob/056095624298b0e017652794677e9ba43f7f5ed8/mici/adapters.py#L256-L263" class="git-link">Browse git</a>
1251+
<a href="https://github.com/matt-graham/mici/blob/aaaad1aae5ce2d12baf95e59bc5ade40149c397b/mici/adapters.py#L259-L266" class="git-link">Browse git</a>
12461252
</summary>
12471253
<pre><code class="python">def finalize(self, adapt_state, transition):
12481254
if isinstance(adapt_state, dict):
@@ -1301,7 +1307,7 @@ <h2 id="args">Args</h2>
13011307
<details class="source">
13021308
<summary>
13031309
<span>Expand source code</span>
1304-
<a href="https://github.com/matt-graham/mici/blob/056095624298b0e017652794677e9ba43f7f5ed8/mici/adapters.py#L266-L368" class="git-link">Browse git</a>
1310+
<a href="https://github.com/matt-graham/mici/blob/aaaad1aae5ce2d12baf95e59bc5ade40149c397b/mici/adapters.py#L269-L371" class="git-link">Browse git</a>
13051311
</summary>
13061312
<pre><code class="python">class OnlineVarianceMetricAdapter(Adapter):
13071313
&#34;&#34;&#34;Diagonal metric adapter using online variance estimates.
@@ -1448,7 +1454,7 @@ <h2 id="returns">Returns</h2>
14481454
<details class="source">
14491455
<summary>
14501456
<span>Expand source code</span>
1451-
<a href="https://github.com/matt-graham/mici/blob/056095624298b0e017652794677e9ba43f7f5ed8/mici/adapters.py#L311-L316" class="git-link">Browse git</a>
1457+
<a href="https://github.com/matt-graham/mici/blob/aaaad1aae5ce2d12baf95e59bc5ade40149c397b/mici/adapters.py#L314-L319" class="git-link">Browse git</a>
14521458
</summary>
14531459
<pre><code class="python">def initialize(self, chain_state, transition):
14541460
return {
@@ -1485,7 +1491,7 @@ <h2 id="args">Args</h2>
14851491
<details class="source">
14861492
<summary>
14871493
<span>Expand source code</span>
1488-
<a href="https://github.com/matt-graham/mici/blob/056095624298b0e017652794677e9ba43f7f5ed8/mici/adapters.py#L318-L327" class="git-link">Browse git</a>
1494+
<a href="https://github.com/matt-graham/mici/blob/aaaad1aae5ce2d12baf95e59bc5ade40149c397b/mici/adapters.py#L321-L330" class="git-link">Browse git</a>
14891495
</summary>
14901496
<pre><code class="python">def update(self, adapt_state, chain_state, trans_stats, transition):
14911497
# Use Welford (1962) incremental algorithm to update statistics to
@@ -1523,7 +1529,7 @@ <h2 id="args">Args</h2>
15231529
<details class="source">
15241530
<summary>
15251531
<span>Expand source code</span>
1526-
<a href="https://github.com/matt-graham/mici/blob/056095624298b0e017652794677e9ba43f7f5ed8/mici/adapters.py#L339-L368" class="git-link">Browse git</a>
1532+
<a href="https://github.com/matt-graham/mici/blob/aaaad1aae5ce2d12baf95e59bc5ade40149c397b/mici/adapters.py#L342-L371" class="git-link">Browse git</a>
15271533
</summary>
15281534
<pre><code class="python">def finalize(self, adapt_state, transition):
15291535
if isinstance(adapt_state, dict):
@@ -1605,7 +1611,7 @@ <h2 id="args">Args</h2>
16051611
<details class="source">
16061612
<summary>
16071613
<span>Expand source code</span>
1608-
<a href="https://github.com/matt-graham/mici/blob/056095624298b0e017652794677e9ba43f7f5ed8/mici/adapters.py#L371-L476" class="git-link">Browse git</a>
1614+
<a href="https://github.com/matt-graham/mici/blob/aaaad1aae5ce2d12baf95e59bc5ade40149c397b/mici/adapters.py#L374-L479" class="git-link">Browse git</a>
16091615
</summary>
16101616
<pre><code class="python">class OnlineCovarianceMetricAdapter(Adapter):
16111617
&#34;&#34;&#34;Dense metric adapter using online covariance estimates.
@@ -1755,7 +1761,7 @@ <h2 id="returns">Returns</h2>
17551761
<details class="source">
17561762
<summary>
17571763
<span>Expand source code</span>
1758-
<a href="https://github.com/matt-graham/mici/blob/056095624298b0e017652794677e9ba43f7f5ed8/mici/adapters.py#L418-L425" class="git-link">Browse git</a>
1764+
<a href="https://github.com/matt-graham/mici/blob/aaaad1aae5ce2d12baf95e59bc5ade40149c397b/mici/adapters.py#L421-L428" class="git-link">Browse git</a>
17591765
</summary>
17601766
<pre><code class="python">def initialize(self, chain_state, transition):
17611767
dim_pos = chain_state.pos.shape[0]
@@ -1794,7 +1800,7 @@ <h2 id="args">Args</h2>
17941800
<details class="source">
17951801
<summary>
17961802
<span>Expand source code</span>
1797-
<a href="https://github.com/matt-graham/mici/blob/056095624298b0e017652794677e9ba43f7f5ed8/mici/adapters.py#L427-L436" class="git-link">Browse git</a>
1803+
<a href="https://github.com/matt-graham/mici/blob/aaaad1aae5ce2d12baf95e59bc5ade40149c397b/mici/adapters.py#L430-L439" class="git-link">Browse git</a>
17981804
</summary>
17991805
<pre><code class="python">def update(self, adapt_state, chain_state, trans_stats, transition):
18001806
# Use Welford (1962) incremental algorithm to update statistics to
@@ -1832,7 +1838,7 @@ <h2 id="args">Args</h2>
18321838
<details class="source">
18331839
<summary>
18341840
<span>Expand source code</span>
1835-
<a href="https://github.com/matt-graham/mici/blob/056095624298b0e017652794677e9ba43f7f5ed8/mici/adapters.py#L448-L476" class="git-link">Browse git</a>
1841+
<a href="https://github.com/matt-graham/mici/blob/aaaad1aae5ce2d12baf95e59bc5ade40149c397b/mici/adapters.py#L451-L479" class="git-link">Browse git</a>
18361842
</summary>
18371843
<pre><code class="python">def finalize(self, adapt_state, transition):
18381844
if isinstance(adapt_state, dict):

docs/docs/autodiff.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ <h1 class="title">Module <code>mici.autodiff</code></h1>
4747
<details class="source">
4848
<summary>
4949
<span>Expand source code</span>
50-
<a href="https://github.com/matt-graham/mici/blob/056095624298b0e017652794677e9ba43f7f5ed8/mici/autodiff.py#L0-L58" class="git-link">Browse git</a>
50+
<a href="https://github.com/matt-graham/mici/blob/aaaad1aae5ce2d12baf95e59bc5ade40149c397b/mici/autodiff.py#L0-L58" class="git-link">Browse git</a>
5151
</summary>
5252
<pre><code class="python">&#34;&#34;&#34;Automatic differentation fallback for constructing derivative functions.&#34;&#34;&#34;
5353

@@ -148,7 +148,7 @@ <h2 id="returns">Returns</h2>
148148
<details class="source">
149149
<summary>
150150
<span>Expand source code</span>
151-
<a href="https://github.com/matt-graham/mici/blob/056095624298b0e017652794677e9ba43f7f5ed8/mici/autodiff.py#L30-L59" class="git-link">Browse git</a>
151+
<a href="https://github.com/matt-graham/mici/blob/aaaad1aae5ce2d12baf95e59bc5ade40149c397b/mici/autodiff.py#L30-L59" class="git-link">Browse git</a>
152152
</summary>
153153
<pre><code class="python">def autodiff_fallback(diff_func, func, diff_op_name, name):
154154
&#34;&#34;&#34;Generate derivative function automatically if not provided.

docs/docs/autograd_wrapper.html

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ <h1 class="title">Module <code>mici.autograd_wrapper</code></h1>
5151
<details class="source">
5252
<summary>
5353
<span>Expand source code</span>
54-
<a href="https://github.com/matt-graham/mici/blob/056095624298b0e017652794677e9ba43f7f5ed8/mici/autograd_wrapper.py#L0-L124" class="git-link">Browse git</a>
54+
<a href="https://github.com/matt-graham/mici/blob/aaaad1aae5ce2d12baf95e59bc5ade40149c397b/mici/autograd_wrapper.py#L0-L124" class="git-link">Browse git</a>
5555
</summary>
5656
<pre><code class="python">&#34;&#34;&#34;Additional autograd differential operators.&#34;&#34;&#34;
5757

@@ -195,7 +195,7 @@ <h2 class="section-title" id="header-functions">Functions</h2>
195195
<details class="source">
196196
<summary>
197197
<span>Expand source code</span>
198-
<a href="https://github.com/matt-graham/mici/blob/056095624298b0e017652794677e9ba43f7f5ed8/mici/autograd_wrapper.py#L24-L33" class="git-link">Browse git</a>
198+
<a href="https://github.com/matt-graham/mici/blob/aaaad1aae5ce2d12baf95e59bc5ade40149c397b/mici/autograd_wrapper.py#L24-L33" class="git-link">Browse git</a>
199199
</summary>
200200
<pre><code class="python">@_wrapped_unary_to_nary
201201
def grad_and_value(fun, x):
@@ -220,7 +220,7 @@ <h2 class="section-title" id="header-functions">Functions</h2>
220220
<details class="source">
221221
<summary>
222222
<span>Expand source code</span>
223-
<a href="https://github.com/matt-graham/mici/blob/056095624298b0e017652794677e9ba43f7f5ed8/mici/autograd_wrapper.py#L36-L53" class="git-link">Browse git</a>
223+
<a href="https://github.com/matt-graham/mici/blob/aaaad1aae5ce2d12baf95e59bc5ade40149c397b/mici/autograd_wrapper.py#L36-L53" class="git-link">Browse git</a>
224224
</summary>
225225
<pre><code class="python">@_wrapped_unary_to_nary
226226
def jacobian_and_value(fun, x):
@@ -262,7 +262,7 @@ <h2 class="section-title" id="header-functions">Functions</h2>
262262
<details class="source">
263263
<summary>
264264
<span>Expand source code</span>
265-
<a href="https://github.com/matt-graham/mici/blob/056095624298b0e017652794677e9ba43f7f5ed8/mici/autograd_wrapper.py#L56-L78" class="git-link">Browse git</a>
265+
<a href="https://github.com/matt-graham/mici/blob/aaaad1aae5ce2d12baf95e59bc5ade40149c397b/mici/autograd_wrapper.py#L56-L78" class="git-link">Browse git</a>
266266
</summary>
267267
<pre><code class="python">@_wrapped_unary_to_nary
268268
def mhp_jacobian_and_value(fun, x):
@@ -300,7 +300,7 @@ <h2 class="section-title" id="header-functions">Functions</h2>
300300
<details class="source">
301301
<summary>
302302
<span>Expand source code</span>
303-
<a href="https://github.com/matt-graham/mici/blob/056095624298b0e017652794677e9ba43f7f5ed8/mici/autograd_wrapper.py#L81-L99" class="git-link">Browse git</a>
303+
<a href="https://github.com/matt-graham/mici/blob/aaaad1aae5ce2d12baf95e59bc5ade40149c397b/mici/autograd_wrapper.py#L81-L99" class="git-link">Browse git</a>
304304
</summary>
305305
<pre><code class="python">@_wrapped_unary_to_nary
306306
def hessian_grad_and_value(fun, x):
@@ -342,7 +342,7 @@ <h2 class="section-title" id="header-functions">Functions</h2>
342342
<details class="source">
343343
<summary>
344344
<span>Expand source code</span>
345-
<a href="https://github.com/matt-graham/mici/blob/056095624298b0e017652794677e9ba43f7f5ed8/mici/autograd_wrapper.py#L102-L125" class="git-link">Browse git</a>
345+
<a href="https://github.com/matt-graham/mici/blob/aaaad1aae5ce2d12baf95e59bc5ade40149c397b/mici/autograd_wrapper.py#L102-L125" class="git-link">Browse git</a>
346346
</summary>
347347
<pre><code class="python">@_wrapped_unary_to_nary
348348
def mtp_hessian_grad_and_value(fun, x):

0 commit comments

Comments
 (0)