Skip to content

Commit 0a4d73e

Browse files
committed
deploy: ac8dc61
1 parent fa28cb6 commit 0a4d73e

File tree

14 files changed

+422
-317
lines changed

14 files changed

+422
-317
lines changed

MCintegration.html

Lines changed: 36 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<meta charset="utf-8"/>
66
<meta content="width=device-width, initial-scale=1.0" name="viewport"/><meta content="width=device-width, initial-scale=1" name="viewport"/>
77
<title>MCintegration package — MCintegration 1.0.0 documentation</title>
8-
<link href="_static/pygments.css?v=0c472235" rel="stylesheet" type="text/css"/>
8+
<link href="_static/pygments.css?v=4848ba22" rel="stylesheet" type="text/css"/>
99
<link href="_static/pyramid.css?v=424f8d56" rel="stylesheet" type="text/css"/>
1010
<script src="_static/documentation_options.js?v=8d563738"></script>
1111
<script src="_static/doctools.js?v=9bcbadda"></script>
@@ -232,26 +232,14 @@ <h2>Submodules<a class="headerlink" href="#submodules" title="Link to this headi
232232
<dd><p>Bases: <a class="reference internal" href="#MCintegration.maps.Map" title="MCintegration.maps.Map"><code class="xref py py-class docutils literal notranslate"><span class="pre">Map</span></code></a></p>
233233
<dl class="py method">
234234
<dt class="sig sig-object py" id="MCintegration.maps.Vegas.adapt">
235-
<span class="sig-name descname"><span class="pre">adapt</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">alpha</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">0.0</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/MCintegration/maps.html#Vegas.adapt"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#MCintegration.maps.Vegas.adapt" title="Link to this definition"></a></dt>
236-
<dd><p>Adapt grid to accumulated training data.</p>
237-
<p><code class="docutils literal notranslate"><span class="pre">self.adapt(...)</span></code> projects the training data onto
238-
each axis independently and maps it into <code class="docutils literal notranslate"><span class="pre">x</span></code> space.
239-
It shrinks <code class="docutils literal notranslate"><span class="pre">x</span></code>-grid increments in regions where the
240-
projected training data is large, and grows increments
241-
where the projected data is small. The grid along
242-
any direction is unchanged if the training data
243-
is constant along that direction.</p>
244-
<p>The number of increments along a direction can be
245-
changed by setting parameter <code class="docutils literal notranslate"><span class="pre">ninc</span></code> (array or number).</p>
246-
<p>The grid does not change if no training data has
247-
been accumulated, unless <code class="docutils literal notranslate"><span class="pre">ninc</span></code> is specified, in
248-
which case the number of increments is adjusted
249-
while preserving the relative density of increments
250-
at different values of <code class="docutils literal notranslate"><span class="pre">x</span></code>.</p>
235+
<span class="sig-name descname"><span class="pre">adapt</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">alpha</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">0.5</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/MCintegration/maps.html#Vegas.adapt"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#MCintegration.maps.Vegas.adapt" title="Link to this definition"></a></dt>
236+
<dd><p>Adapt the grid based on accumulated training data.</p>
237+
<p>Shrinks grid increments in regions where the accumulated f is large,
238+
and grows them where f is small. The adaptation speed is controlled by alpha.</p>
251239
<dl class="field-list simple">
252240
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
253-
<dd class="field-odd"><p><strong>alpha</strong> (<em>float</em>) – Determines the speed with which the grid
254-
adapts to training data. Large (postive) values imply
241+
<dd class="field-odd"><p><strong>alpha</strong> (<em>float</em><em>, </em><em>optional</em>) – Determines the speed with which the grid
242+
adapts to training data. Large (positive) values imply
255243
rapid evolution; small values (much less than one) imply
256244
slow evolution. Typical values are of order one. Choosing
257245
<code class="docutils literal notranslate"><span class="pre">alpha&lt;0</span></code> causes adaptation to the unmodified training
@@ -262,7 +250,21 @@ <h2>Submodules<a class="headerlink" href="#submodules" title="Link to this headi
262250
<dl class="py method">
263251
<dt class="sig sig-object py" id="MCintegration.maps.Vegas.adaptive_training">
264252
<span class="sig-name descname"><span class="pre">adaptive_training</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">batch_size</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">f</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">f_dim</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">1</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">epoch</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">10</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">alpha</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">0.5</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/MCintegration/maps.html#Vegas.adaptive_training"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#MCintegration.maps.Vegas.adaptive_training" title="Link to this definition"></a></dt>
265-
<dd></dd></dl>
253+
<dd><blockquote>
254+
<div><p>Perform adaptive training to adjust the grid based on the training function.</p>
255+
</div></blockquote>
256+
<dl class="field-list simple">
257+
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
258+
<dd class="field-odd"><ul class="simple">
259+
<li><p><strong>batch_size</strong> (<em>int</em>) – Number of samples per batch.</p></li>
260+
<li><p><strong>f</strong> (<em>callable</em>) – Training function that takes x and fx as inputs.</p></li>
261+
<li><p><strong>f_dim</strong> (<em>int</em><em>, </em><em>optional</em>) – Dimension of the function f. Defaults to 1.</p></li>
262+
<li><p><strong>epoch</strong> (<em>int</em><em>, </em><em>optional</em>) – Number of training epochs. Defaults to 10.</p></li>
263+
<li><p><strong>alpha</strong> (<em>float</em><em>, </em><em>optional</em>) – Adaptation rate. Defaults to 0.5.</p></li>
264+
</ul>
265+
</dd>
266+
</dl>
267+
</dd></dl>
266268
<dl class="py method">
267269
<dt class="sig sig-object py" id="MCintegration.maps.Vegas.add_training_data">
268270
<span class="sig-name descname"><span class="pre">add_training_data</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">sample</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/MCintegration/maps.html#Vegas.add_training_data"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#MCintegration.maps.Vegas.add_training_data" title="Link to this definition"></a></dt>
@@ -310,7 +312,20 @@ <h2>Submodules<a class="headerlink" href="#submodules" title="Link to this headi
310312
<dl class="py method">
311313
<dt class="sig sig-object py" id="MCintegration.maps.Vegas.inverse">
312314
<span class="sig-name descname"><span class="pre">inverse</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">x</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/MCintegration/maps.html#Vegas.inverse"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#MCintegration.maps.Vegas.inverse" title="Link to this definition"></a></dt>
313-
<dd></dd></dl>
315+
<dd><p>Inverse map from x-space to u-space.</p>
316+
<dl class="field-list simple">
317+
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
318+
<dd class="field-odd"><p><strong>x</strong> (<em>torch.Tensor</em>) – Tensor of shape (batch_size, dim) representing points in x-space.</p>
319+
</dd>
320+
<dt class="field-even">Returns<span class="colon">:</span></dt>
321+
<dd class="field-even"><p>Tensor of shape (batch_size, dim) representing points in u-space.
322+
log_detJ (torch.Tensor): Tensor of shape (batch_size,) representing the log determinant of the Jacobian.</p>
323+
</dd>
324+
<dt class="field-odd">Return type<span class="colon">:</span></dt>
325+
<dd class="field-odd"><p>u (torch.Tensor)</p>
326+
</dd>
327+
</dl>
328+
</dd></dl>
314329
<dl class="py method">
315330
<dt class="sig sig-object py" id="MCintegration.maps.Vegas.make_uniform">
316331
<span class="sig-name descname"><span class="pre">make_uniform</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/MCintegration/maps.html#Vegas.make_uniform"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#MCintegration.maps.Vegas.make_uniform" title="Link to this definition"></a></dt>

0 commit comments

Comments
 (0)