-
Notifications
You must be signed in to change notification settings - Fork 758
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cd950bd
commit 698da3b
Showing
71 changed files
with
2,602 additions
and
838 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,234 @@ | ||
<!DOCTYPE html> | ||
<html xmlns="http://www.w3.org/1999/xhtml"> | ||
<head> | ||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | ||
<meta http-equiv="Content-Style-Type" content="text/css" /> | ||
<meta name="generator" content="pandoc" /> | ||
<title>Edward – ed.ReplicaExchangeMC</title> | ||
<!-- Mobile Specific Metas --> | ||
<meta name="viewport" content="width=device-width, initial-scale=1"> | ||
|
||
<!-- FONT --> | ||
<link href="https://fonts.googleapis.com/css?family=Lora:400,400i,700" rel="stylesheet"> | ||
|
||
<!-- CSS --> | ||
<link rel="stylesheet" href="/css/normalize.css"> | ||
<link rel="stylesheet" href="/css/skeleton.css"> | ||
<!-- Dynamically resize logo for mobile --> | ||
<style type="text/css"> | ||
.logo-width { | ||
width: 100%; | ||
box-sizing: border-box; | ||
margin-bottom: 15%; | ||
} | ||
/* Roughly the point when website is single column */ | ||
@media (max-width: 850px) { | ||
.logo-width { | ||
width: 50%; | ||
box-sizing: border-box; | ||
margin-bottom: 5%; | ||
} | ||
} | ||
/* Downgrade API's header styles without explicitly modifying their type. */ | ||
div.nine.columns h1 { text-align: left; } | ||
div.nine.columns h1 { font-size: 3.0rem; line-height: 1.25; letter-spacing: -.1rem; } | ||
div.nine.columns h2 { font-size: 2.4rem; line-height: 1.3; letter-spacing: -.1rem; } | ||
div.nine.columns h3 { font-size: 2.4rem; line-height: 1.35; letter-spacing: -.08rem; } | ||
div.nine.columns h4 { font-size: 1.8rem; line-height: 1.5; letter-spacing: -.05rem; } | ||
div.nine.columns h5 { font-size: 1.5rem; line-height: 1.6; letter-spacing: 0; } | ||
@media (min-width: 550px) { | ||
div.nine.columns h1 { font-size: 3.6rem; } | ||
div.nine.columns h2 { font-size: 3.0rem; } | ||
div.nine.columns h3 { font-size: 3.0rem; } | ||
div.nine.columns h4 { font-size: 2.5rem; } | ||
div.nine.columns h5 { font-size: 1.5rem; } | ||
} | ||
</style> | ||
|
||
<!-- KaTeX --> | ||
<script src="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.7.1/katex.min.js"></script> | ||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.7.1/katex.min.css" /> | ||
<script src="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.7.1/contrib/auto-render.min.js"></script> | ||
|
||
<!-- highlight.js --> | ||
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.4.0/highlight.min.js"></script> | ||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.4.0/styles/github.min.css"> | ||
|
||
<!-- Favicon --> | ||
<link rel="apple-touch-icon" sizes="57x57" href="/icons/apple-touch-icon-57x57.png"> | ||
<link rel="apple-touch-icon" sizes="60x60" href="/icons/apple-touch-icon-60x60.png"> | ||
<link rel="apple-touch-icon" sizes="72x72" href="/icons/apple-touch-icon-72x72.png"> | ||
<link rel="apple-touch-icon" sizes="76x76" href="/icons/apple-touch-icon-76x76.png"> | ||
<link rel="apple-touch-icon" sizes="114x114" href="/icons/apple-touch-icon-114x114.png"> | ||
<link rel="apple-touch-icon" sizes="120x120" href="/icons/apple-touch-icon-120x120.png"> | ||
<link rel="apple-touch-icon" sizes="144x144" href="/icons/apple-touch-icon-144x144.png"> | ||
<link rel="apple-touch-icon" sizes="152x152" href="/icons/apple-touch-icon-152x152.png"> | ||
<link rel="apple-touch-icon" sizes="180x180" href="/icons/apple-touch-icon-180x180.png"> | ||
<link rel="icon" type="image/png" href="/icons/favicon-32x32.png" sizes="32x32"> | ||
<link rel="icon" type="image/png" href="/icons/android-chrome-192x192.png" sizes="192x192"> | ||
<link rel="icon" type="image/png" href="/icons/favicon-96x96.png" sizes="96x96"> | ||
<link rel="icon" type="image/png" href="/icons/favicon-16x16.png" sizes="16x16"> | ||
<link rel="manifest" href="/icons/manifest.json"> | ||
<link rel="mask-icon" href="/icons/safari-pinned-tab.svg" color="#5bbad5"> | ||
<link rel="shortcut icon" href="/icons/favicon.ico"> | ||
<meta name="msapplication-TileColor" content="#da532c"> | ||
<meta name="msapplication-TileImage" content="/icons/mstile-144x144.png"> | ||
<meta name="msapplication-config" content="/icons/browserconfig.xml"> | ||
<meta name="theme-color" content="#ffffff"> | ||
</head> | ||
<body> | ||
<div class="container"> | ||
<div class="row" style="margin-top: 5%"> | ||
<div class="three columns"> | ||
<h1><a href="/">Edward</a></h1> | ||
<a href="/"> | ||
<center> | ||
<img src="/images/edward.png" class="logo-width" alt="Edward" /> | ||
</center> | ||
</a> | ||
<a class="button u-full-width" href="/api/">API</a> | ||
<hr style="margin-top: 1rem; margin-bottom: 1.5rem;"/> | ||
<a class="button u-full-width" href="/api/reference">Reference</a> | ||
<a class="button u-full-width" href="/api/ed/criticisms">ed.criticisms</a> | ||
<a class="button u-full-width" href="/api/ed/inferences">ed.inferences</a> | ||
<a class="button u-full-width" href="/api/ed/models">ed.models</a> | ||
<a class="button u-full-width" href="/api/ed/util">ed.util</a> | ||
<a class="button u-full-width" href="/api/observations">observations</a> | ||
|
||
<div class="row" style="padding-bottom: 5%"> </div> | ||
<a class="button2 u-pull-right" style="padding-right:10%" | ||
href="https://github.com/blei-lab/edward"> | ||
<span style="vertical-align:middle;">Github</span> | ||
<img src="/images/github-mark.svg" style="vertical-align:middle;" | ||
alt="Edward on Github" /> | ||
</a> | ||
<div class="row" style="padding-bottom: 5%"> </div> | ||
</div> | ||
<div class="nine columns"> | ||
|
||
<div itemscope itemtype="http://developers.google.com/ReferenceObject"> | ||
<meta itemprop="name" content="ed.ReplicaExchangeMC" /> | ||
<meta itemprop="property" content="__init__"/> | ||
<meta itemprop="property" content="build_update"/> | ||
<meta itemprop="property" content="finalize"/> | ||
<meta itemprop="property" content="initialize"/> | ||
<meta itemprop="property" content="print_progress"/> | ||
<meta itemprop="property" content="run"/> | ||
<meta itemprop="property" content="update"/> | ||
</div> | ||
<h1 id="ed.replicaexchangemc">ed.ReplicaExchangeMC</h1> | ||
<h2 id="class-replicaexchangemc">Class <code>ReplicaExchangeMC</code></h2> | ||
<p>Inherits From: <a href="../ed/MonteCarlo"><code>MonteCarlo</code></a></p> | ||
<h3 id="aliases">Aliases:</h3> | ||
<ul> | ||
<li>Class <code>ed.ReplicaExchangeMC</code></li> | ||
<li>Class <code>ed.inferences.ReplicaExchangeMC</code></li> | ||
</ul> | ||
<p>Defined in <a href="https://github.com/blei-lab/edward/tree/master/edward/inferences/replica_exchange_mc.py"><code>edward/inferences/replica_exchange_mc.py</code></a>.</p> | ||
<p>Replica Exchange MCMC <span class="citation" data-cites="swendsen1986replica hukushima1996exchange">(Hukushima & Nemoto, 1996; Swendsen & Wang, 1986)</span>.</p> | ||
<h4 id="examples">Examples</h4> | ||
<pre class="python"><code>cat = Categorical(probs=[0.5,0.5]) | ||
x = Mixture(cat=cat, components=[ | ||
MultivariateNormalDiag([0.0,0.0], [1.0,1.0]), | ||
MultivariateNormalDiag([10.0,10.0], [1.0,1.0])]) | ||
proposal_x = MultivariateNormalDiag(x, [1.0,1.0]) | ||
qx = Empirical(tf.Variable(tf.zeros([10000, 2]))) | ||
inference = ed.ReplicaExchangeMC(latent_vars={x: qx}, | ||
proposal_vars={x: proposal_x})</code></pre> | ||
<h2 id="methods">Methods</h2> | ||
<h3 id="__init__"> | ||
<code><strong>init</strong></code> | ||
</h3> | ||
<pre class="python"><code>__init__( | ||
latent_vars, | ||
proposal_vars, | ||
data=None, | ||
inverse_temperatures=np.logspace(0, -2, 5), | ||
exchange_freq=0.1 | ||
)</code></pre> | ||
<p>Create an inference algorithm.</p> | ||
<h4 id="args">Args:</h4> | ||
<ul> | ||
<li><b><code>proposal_vars</code></b>: dict of RandomVariable to RandomVariable. Collection of random variables to perform inference on; each is binded to a proposal distribution <span class="math inline">\(g(z' \mid z)\)</span>.</li> | ||
<li><b><code>inverse_temperatures</code></b>: list of inverse temperature.</li> | ||
<li><b><code>exchange_freq</code></b>: frequency of exchanging replica.</li> | ||
</ul> | ||
<h3 id="build_update"> | ||
<code>build_update</code> | ||
</h3> | ||
<pre class="python"><code>build_update()</code></pre> | ||
<p>Perform sampling and exchange.</p> | ||
<h3 id="finalize"> | ||
<code>finalize</code> | ||
</h3> | ||
<pre class="python"><code>finalize()</code></pre> | ||
<p>Function to call after convergence.</p> | ||
<h3 id="initialize"> | ||
<code>initialize</code> | ||
</h3> | ||
<pre class="python"><code>initialize( | ||
*args, | ||
**kwargs | ||
)</code></pre> | ||
<h3 id="print_progress"> | ||
<code>print_progress</code> | ||
</h3> | ||
<pre class="python"><code>print_progress(info_dict)</code></pre> | ||
<p>Print progress to output.</p> | ||
<h3 id="run"> | ||
<code>run</code> | ||
</h3> | ||
<pre class="python"><code>run( | ||
variables=None, | ||
use_coordinator=True, | ||
*args, | ||
**kwargs | ||
)</code></pre> | ||
<p>A simple wrapper to run inference.</p> | ||
<ol type="1"> | ||
<li>Initialize algorithm via <code>initialize</code>.</li> | ||
<li>(Optional) Build a TensorFlow summary writer for TensorBoard.</li> | ||
<li>(Optional) Initialize TensorFlow variables.</li> | ||
<li>(Optional) Start queue runners.</li> | ||
<li>Run <code>update</code> for <code>self.n_iter</code> iterations.</li> | ||
<li>While running, <code>print_progress</code>.</li> | ||
<li>Finalize algorithm via <code>finalize</code>.</li> | ||
<li>(Optional) Stop queue runners.</li> | ||
</ol> | ||
<p>To customize the way inference is run, run these steps individually.</p> | ||
<h4 id="args-1">Args:</h4> | ||
<ul> | ||
<li><b><code>variables</code></b>: list. A list of TensorFlow variables to initialize during inference. Default is to initialize all variables (this includes reinitializing variables that were already initialized). To avoid initializing any variables, pass in an empty list.</li> | ||
<li><b><code>use_coordinator</code></b>: bool. Whether to start and stop queue runners during inference using a TensorFlow coordinator. For example, queue runners are necessary for batch training with file readers. *args, **kwargs: Passed into <code>initialize</code>.</li> | ||
</ul> | ||
<h3 id="update"> | ||
<code>update</code> | ||
</h3> | ||
<pre class="python"><code>update(feed_dict=None)</code></pre> | ||
<p>Run one iteration of sampling.</p> | ||
<h4 id="args-2">Args:</h4> | ||
<ul> | ||
<li><b><code>feed_dict</code></b>: dict. Feed dictionary for a TensorFlow session run. It is used to feed placeholders that are not fed during initialization.</li> | ||
</ul> | ||
<h4 id="returns">Returns:</h4> | ||
<p>dict. Dictionary of algorithm-specific information. In this case, the acceptance rate of samples since (and including) this iteration.</p> | ||
<h4 id="notes">Notes</h4> | ||
<p>We run the increment of <code>t</code> separately from other ops. Whether the others op run with the <code>t</code> before incrementing or after incrementing depends on which is run faster in the TensorFlow graph. Running it separately forces a consistent behavior.</p> | ||
<div id="refs" class="references"> | ||
<div id="ref-hukushima1996exchange"> | ||
<p>Hukushima, K., & Nemoto, K. (1996). Exchange monte carlo method and application to spin glass simulations. <em>Journal of the Physical Society of Japan</em>, <em>65</em>(6), 1604–1608.</p> | ||
</div> | ||
<div id="ref-swendsen1986replica"> | ||
<p>Swendsen, R. H., & Wang, J.-S. (1986). Replica monte carlo simulation of spin-glasses. <em>Physical Review Letters</em>, <em>57</em>(21), 2607.</p> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
<div class="row" style="padding-bottom: 25%"> </div> | ||
</div> | ||
<script> | ||
hljs.initHighlightingOnLoad(); | ||
renderMathInElement(document.body); | ||
</script> | ||
</body> | ||
</html> |
Oops, something went wrong.