Skip to content

Commit

Permalink
Update documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
stratisMarkou committed Dec 24, 2024
1 parent 072582e commit 7936a41
Show file tree
Hide file tree
Showing 40 changed files with 732 additions and 17 deletions.
47 changes: 47 additions & 0 deletions _sources/book/topology/002-topological-spaces.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Topological Spaces

<script async defer src="https://buttons.github.io/buttons.js"></script>
<a class="github-button" href="https://github.com/stratisMarkou/random-walks" data-color-scheme="no-preference: light; light: light; dark: dark;" data-icon="octicon-star" data-size="large" aria-label="Star stratisMarkou/random-walks on GitHub">Star</a>
<a class="github-button" href="https://github.com/stratisMarkou/random-walks/issues" data-color-scheme="no-preference: light; light: light; dark: dark;" data-icon="octicon-issue-opened" data-size="large" aria-label="Issue stratisMarkou/random-walks on GitHub">Issue</a>
<a class="github-button" href="https://github.com/stratisMarkou/random-walks/subscription" data-color-scheme="no-preference: light; light: light; dark: dark;" data-icon="octicon-eye" data-size="large" aria-label="Watch stratisMarkou/random-walks on GitHub">Watch</a>
<a class="github-button" href="https://github.com/stratisMarkou" data-color-scheme="no-preference: light; light: light; dark: dark;" data-size="large" aria-label="Follow @stratisMarkou on GitHub">Follow</a>

In the previous chapter we saw that in a metric space, continuity of functions is only indirectly determined by the metric itself.
Instead, the structure that determines continuity {prf:ref}`is the set of open sets<topology:theorem-characterisation-of-continuity>`.
This motivates the definition of a topological space, which abstracts the notion of open sets from metric spaces.

## Topologies
First, we define topological spaces.
These are sets equipped with a topology, a collection of subsets which we _define_ to be open.
Unlike in metric spaces, where we first defined open balls and then used them to define open sets, here we define open sets directly, and require they satisfy certain properties.

:::{prf:definition} Topological space
:label: topology:def-topological-space
A topological space is a set $X,$ called the space, together with a collection $\mathcal{U} \subseteq \mathcal{P}(X)$ of subsets of $X,$ called the topology on $X,$ such that

1. $\emptyset, X \in \mathcal{U},$
2. If ${U_i}_{i \in I} \subseteq \mathcal{U},$ then $\bigcup_{i \in I} U_i \in \mathcal{U},$
3. If $U_1, \dots, U_n \in \mathcal{U},$ then $\bigcap_{i=1}^n U_i \in \mathcal{U}.$

The elements of $X$ are called points, and the elements of $\mathcal{U}$ are called open sets.
:::


When working with specific spaces, they will often be already be equipped with a metric.
We refer to the topology associated with a given metric as the induced topology.

:::{prf:definition} Induced topology
:label: topology:def-induced-topology
Let $(X, d)$ be a metric space.
Then, the topology induced by $d$ is the set of all open sets in $X$ with respect to the metric $d.$
:::


We now also re-define continuity in terms of open sets.

:::{prf:definition} Continuous function
:label: topology:def-continuous-function-topology
Let $f: X \to Y$ be a function between topological spaces.
Then, $f$ is continuous if for every open set $U \subseteq Y,$ the pre-image $f^{-1}(U)$ is an open set in $X.$
:::

1 change: 1 addition & 0 deletions book/mira/000-exercises.html
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@
</li>
<li class="toctree-l1 has-children"><a class="reference internal" href="../topology/000-intro.html">Topology</a><input class="toctree-checkbox" id="toctree-checkbox-4" name="toctree-checkbox-4" type="checkbox"/><label class="toctree-toggle" for="toctree-checkbox-4"><i class="fa-solid fa-chevron-down"></i></label><ul>
<li class="toctree-l2"><a class="reference internal" href="../topology/001-metric-spaces.html">Metric spaces</a></li>
<li class="toctree-l2"><a class="reference internal" href="../topology/002-topological-spaces.html">Topological Spaces</a></li>
</ul>
</li>
</ul>
Expand Down
1 change: 1 addition & 0 deletions book/mira/000-intro.html
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@
</li>
<li class="toctree-l1 has-children"><a class="reference internal" href="../topology/000-intro.html">Topology</a><input class="toctree-checkbox" id="toctree-checkbox-4" name="toctree-checkbox-4" type="checkbox"/><label class="toctree-toggle" for="toctree-checkbox-4"><i class="fa-solid fa-chevron-down"></i></label><ul>
<li class="toctree-l2"><a class="reference internal" href="../topology/001-metric-spaces.html">Metric spaces</a></li>
<li class="toctree-l2"><a class="reference internal" href="../topology/002-topological-spaces.html">Topological Spaces</a></li>
</ul>
</li>
</ul>
Expand Down
1 change: 1 addition & 0 deletions book/mira/001-riemann.html
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@
</li>
<li class="toctree-l1 has-children"><a class="reference internal" href="../topology/000-intro.html">Topology</a><input class="toctree-checkbox" id="toctree-checkbox-4" name="toctree-checkbox-4" type="checkbox"/><label class="toctree-toggle" for="toctree-checkbox-4"><i class="fa-solid fa-chevron-down"></i></label><ul>
<li class="toctree-l2"><a class="reference internal" href="../topology/001-metric-spaces.html">Metric spaces</a></li>
<li class="toctree-l2"><a class="reference internal" href="../topology/002-topological-spaces.html">Topological Spaces</a></li>
</ul>
</li>
</ul>
Expand Down
1 change: 1 addition & 0 deletions book/mira/002-measures.html
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@
</li>
<li class="toctree-l1 has-children"><a class="reference internal" href="../topology/000-intro.html">Topology</a><input class="toctree-checkbox" id="toctree-checkbox-4" name="toctree-checkbox-4" type="checkbox"/><label class="toctree-toggle" for="toctree-checkbox-4"><i class="fa-solid fa-chevron-down"></i></label><ul>
<li class="toctree-l2"><a class="reference internal" href="../topology/001-metric-spaces.html">Metric spaces</a></li>
<li class="toctree-l2"><a class="reference internal" href="../topology/002-topological-spaces.html">Topological Spaces</a></li>
</ul>
</li>
</ul>
Expand Down
5 changes: 3 additions & 2 deletions book/papers/ais/ais.html
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@
</li>
<li class="toctree-l1 has-children"><a class="reference internal" href="../../topology/000-intro.html">Topology</a><input class="toctree-checkbox" id="toctree-checkbox-4" name="toctree-checkbox-4" type="checkbox"/><label class="toctree-toggle" for="toctree-checkbox-4"><i class="fa-solid fa-chevron-down"></i></label><ul>
<li class="toctree-l2"><a class="reference internal" href="../../topology/001-metric-spaces.html">Metric spaces</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../topology/002-topological-spaces.html">Topological Spaces</a></li>
</ul>
</li>
</ul>
Expand Down Expand Up @@ -648,7 +649,7 @@ <h2>Importance-weighted MCMC<a class="headerlink" href="#importance-weighted-mcm
So we could, in principle, use MCMC within an importance-weighted estimator to reduce its variance.
The following algorithm is based on this intuition.</p>
<div class="proof definition admonition" id="definition-1">
<p class="admonition-title"><span class="caption-number">Definition 80 </span> (Importance weighted MCMC algorithm)</p>
<p class="admonition-title"><span class="caption-number">Definition 83 </span> (Importance weighted MCMC algorithm)</p>
<section class="definition-content" id="proof-content">
<p>Given a proposal density <span class="math notranslate nohighlight">\(q\)</span>, a target density <span class="math notranslate nohighlight">\(p\)</span> and a sequence of transition kernels <span class="math notranslate nohighlight">\(T_1(x, x'), \dots, T_K(x, x')\)</span> be a sequence of transition kernels such that <span class="math notranslate nohighlight">\(T_k\)</span> leaves <span class="math notranslate nohighlight">\(p\)</span> invariant.
Sampling <span class="math notranslate nohighlight">\(x_0 \sim q(x)\)</span> followed by</p>
Expand Down Expand Up @@ -736,7 +737,7 @@ <h2>Annealed Importance Sampling<a class="headerlink" href="#id2" title="Link to
<p>These distributions interpolate between <span class="math notranslate nohighlight">\(q\)</span> and <span class="math notranslate nohighlight">\(p\)</span> as we vary <span class="math notranslate nohighlight">\(\beta\)</span>.
AIS then proceeds in a similar way to the importance weighted MCMC algorithm we highlighted above, except that it requires that each <span class="math notranslate nohighlight">\(T_k\)</span> leaves <span class="math notranslate nohighlight">\(\pi_k\)</span>, instead of <span class="math notranslate nohighlight">\(p\)</span>, invariant.</p>
<div class="proof definition admonition" id="definition-2">
<p class="admonition-title"><span class="caption-number">Definition 81 </span> (Annealed Importance Sampling)</p>
<p class="admonition-title"><span class="caption-number">Definition 84 </span> (Annealed Importance Sampling)</p>
<section class="definition-content" id="proof-content">
<p>Given a target density <span class="math notranslate nohighlight">\(p\)</span>, a proposal density <span class="math notranslate nohighlight">\(q\)</span> and a sequence <span class="math notranslate nohighlight">\(0 = \beta_0 \leq \dots \leq \beta_K = 1\)</span>, define</p>
<div class="math notranslate nohighlight">
Expand Down
7 changes: 4 additions & 3 deletions book/papers/intro.html
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
<link rel="index" title="Index" href="../../genindex.html" />
<link rel="search" title="Search" href="../../search.html" />
<link rel="next" title="Shifted window transformers" href="swin/swin.html" />
<link rel="prev" title="Metric spaces" href="../topology/001-metric-spaces.html" />
<link rel="prev" title="Topological Spaces" href="../topology/002-topological-spaces.html" />
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<meta name="docsearch:language" content="en"/>
</head>
Expand Down Expand Up @@ -215,6 +215,7 @@
</li>
<li class="toctree-l1 has-children"><a class="reference internal" href="../topology/000-intro.html">Topology</a><input class="toctree-checkbox" id="toctree-checkbox-4" name="toctree-checkbox-4" type="checkbox"/><label class="toctree-toggle" for="toctree-checkbox-4"><i class="fa-solid fa-chevron-down"></i></label><ul>
<li class="toctree-l2"><a class="reference internal" href="../topology/001-metric-spaces.html">Metric spaces</a></li>
<li class="toctree-l2"><a class="reference internal" href="../topology/002-topological-spaces.html">Topological Spaces</a></li>
</ul>
</li>
</ul>
Expand Down Expand Up @@ -473,12 +474,12 @@ <h1>Stream of papers<a class="headerlink" href="#stream-of-papers" title="Link t

<div class="prev-next-area">
<a class="left-prev"
href="../topology/001-metric-spaces.html"
href="../topology/002-topological-spaces.html"
title="previous page">
<i class="fa-solid fa-angle-left"></i>
<div class="prev-next-info">
<p class="prev-next-subtitle">previous</p>
<p class="prev-next-title">Metric spaces</p>
<p class="prev-next-title">Topological Spaces</p>
</div>
</a>
<a class="right-next"
Expand Down
11 changes: 6 additions & 5 deletions book/papers/num-sde/num-sde.html
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@
</li>
<li class="toctree-l1 has-children"><a class="reference internal" href="../../topology/000-intro.html">Topology</a><input class="toctree-checkbox" id="toctree-checkbox-4" name="toctree-checkbox-4" type="checkbox"/><label class="toctree-toggle" for="toctree-checkbox-4"><i class="fa-solid fa-chevron-down"></i></label><ul>
<li class="toctree-l2"><a class="reference internal" href="../../topology/001-metric-spaces.html">Metric spaces</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../topology/002-topological-spaces.html">Topological Spaces</a></li>
</ul>
</li>
</ul>
Expand Down Expand Up @@ -466,7 +467,7 @@ <h2>Why stochastic differential equations<a class="headerlink" href="#why-stocha
<h2>The Wiener process<a class="headerlink" href="#the-wiener-process" title="Link to this heading">#</a></h2>
<p>In order to define the stochastic component of the transition rule of a stochastic system, we must define an appropriate noise model. The Wiener process is a stochastic process that is commonly used for this purpose.</p>
<div class="proof definition admonition" id="definition-0">
<p class="admonition-title"><span class="caption-number">Definition 85 </span> (Wiener process)</p>
<p class="admonition-title"><span class="caption-number">Definition 88 </span> (Wiener process)</p>
<section class="definition-content" id="proof-content">
<p>A standard Wiener process over [0, T] is a random variable <span class="math notranslate nohighlight">\(W(t)\)</span> that depends continuously on <span class="math notranslate nohighlight">\(t \in [0, T]\)</span> and satisfies:</p>
<ol class="arabic simple">
Expand Down Expand Up @@ -649,7 +650,7 @@ <h2>Evaluating a stochastic integral<a class="headerlink" href="#evaluating-a-st
<h2>Euler-Maruyama method<a class="headerlink" href="#euler-maruyama-method" title="Link to this heading">#</a></h2>
<p>The Euler-Maruyama method is the analoge of the Euler method for deterministic integrals, applied to the stochastic case.</p>
<div class="proof definition admonition" id="definition-1">
<p class="admonition-title"><span class="caption-number">Definition 86 </span> (Euler-Maruyama method)</p>
<p class="admonition-title"><span class="caption-number">Definition 89 </span> (Euler-Maruyama method)</p>
<section class="definition-content" id="proof-content">
<p>Given a scalar SDE with drift and diffusion functions <span class="math notranslate nohighlight">\(f\)</span> and <span class="math notranslate nohighlight">\(g\)</span></p>
<div class="math notranslate nohighlight">
Expand Down Expand Up @@ -769,7 +770,7 @@ <h2>Euler-Maruyama method<a class="headerlink" href="#euler-maruyama-method" tit
<h2>Strong and weak convergence<a class="headerlink" href="#strong-and-weak-convergence" title="Link to this heading">#</a></h2>
<p>Since the choice of the number of bins <span class="math notranslate nohighlight">\(N\)</span> of the discretisation affects the accuracy of our method, we are interested in how quickly the approximation converges to the exact solution as a function of <span class="math notranslate nohighlight">\(N\)</span>. To do so, we must first define <em>what convergence means</em> in the stochastic case, which leads us to two disctinct notions of convergence, the strong sence and the weak sense.</p>
<div class="proof definition admonition" id="definition-2">
<p class="admonition-title"><span class="caption-number">Definition 87 </span> (Strong convergence)</p>
<p class="admonition-title"><span class="caption-number">Definition 90 </span> (Strong convergence)</p>
<section class="definition-content" id="proof-content">
<p>A method for approximating a stochastic process <span class="math notranslate nohighlight">\(X(t)\)</span> is said to have strong order of convergence <span class="math notranslate nohighlight">\(\gamma\)</span> if there exists a constant such that</p>
<div class="math notranslate nohighlight">
Expand All @@ -779,7 +780,7 @@ <h2>Strong and weak convergence<a class="headerlink" href="#strong-and-weak-conv
</section>
</div><p>Strong convergence refers to the rate of convergence of the approximation <span class="math notranslate nohighlight">\(X_n\)</span> to the exact solution <span class="math notranslate nohighlight">\(X(\tau_n)\)</span> as <span class="math notranslate nohighlight">\(\Delta t \to 0\)</span>, in expectation. A weaker condition for convergence is rate at which the expected value of the approximation converges to the true expected value, as <span class="math notranslate nohighlight">\(\Delta t \to 0\)</span>, as given below.</p>
<div class="proof definition admonition" id="definition-3">
<p class="admonition-title"><span class="caption-number">Definition 88 </span> (Weak convergence)</p>
<p class="admonition-title"><span class="caption-number">Definition 91 </span> (Weak convergence)</p>
<section class="definition-content" id="proof-content">
<p>A method for approximating a stochastic process <span class="math notranslate nohighlight">\(X(t)\)</span> is said to have weak order of convergence <span class="math notranslate nohighlight">\(\gamma\)</span> if there exists a constant such that</p>
<div class="math notranslate nohighlight">
Expand All @@ -798,7 +799,7 @@ <h2>Strong and weak convergence<a class="headerlink" href="#strong-and-weak-conv
<h2>Milstein’s higher order method<a class="headerlink" href="#milstein-s-higher-order-method" title="Link to this heading">#</a></h2>
<p>Just as higher order methods for ODEs exist for obtaining refined estimates of the solution, so do methods for SDEs, such as Milstein’s higher order method.</p>
<div class="proof definition admonition" id="definition-4">
<p class="admonition-title"><span class="caption-number">Definition 89 </span> (Milstein’s method)</p>
<p class="admonition-title"><span class="caption-number">Definition 92 </span> (Milstein’s method)</p>
<section class="definition-content" id="proof-content">
<p>Given a scalar SDE with drift and diffusion functions <span class="math notranslate nohighlight">\(f\)</span> and <span class="math notranslate nohighlight">\(g\)</span></p>
<div class="math notranslate nohighlight">
Expand Down
3 changes: 2 additions & 1 deletion book/papers/rff/rff.html
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@
</li>
<li class="toctree-l1 has-children"><a class="reference internal" href="../../topology/000-intro.html">Topology</a><input class="toctree-checkbox" id="toctree-checkbox-4" name="toctree-checkbox-4" type="checkbox"/><label class="toctree-toggle" for="toctree-checkbox-4"><i class="fa-solid fa-chevron-down"></i></label><ul>
<li class="toctree-l2"><a class="reference internal" href="../../topology/001-metric-spaces.html">Metric spaces</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../topology/002-topological-spaces.html">Topological Spaces</a></li>
</ul>
</li>
</ul>
Expand Down Expand Up @@ -513,7 +514,7 @@ <h2>The RFF approximation<a class="headerlink" href="#the-rff-approximation" tit
<p>This is also an unbiased estimate of the kernel, however its variance is lower than in the <span class="math notranslate nohighlight">\(M = 1\)</span> case, since the variance of the average of the sum of <span class="math notranslate nohighlight">\(K\)</span> i.i.d. random variables is lower than the variance of a single one of the variables.
We therefore arrive at the following algorithm for estimating <span class="math notranslate nohighlight">\(k\)</span>.</p>
<div class="proof definition admonition" id="definition-1">
<p class="admonition-title"><span class="caption-number">Definition 82 </span> (Random Fourier Features)</p>
<p class="admonition-title"><span class="caption-number">Definition 85 </span> (Random Fourier Features)</p>
<section class="definition-content" id="proof-content">
<p>Given a translation invariant kernel <span class="math notranslate nohighlight">\(k\)</span> that is the Fourier transform of a probability measure <span class="math notranslate nohighlight">\(p\)</span>, we have the unbiased real-valued estimator</p>
<div class="math notranslate nohighlight">
Expand Down
3 changes: 2 additions & 1 deletion book/papers/score-matching/score-matching.html
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@
</li>
<li class="toctree-l1 has-children"><a class="reference internal" href="../../topology/000-intro.html">Topology</a><input class="toctree-checkbox" id="toctree-checkbox-4" name="toctree-checkbox-4" type="checkbox"/><label class="toctree-toggle" for="toctree-checkbox-4"><i class="fa-solid fa-chevron-down"></i></label><ul>
<li class="toctree-l2"><a class="reference internal" href="../../topology/001-metric-spaces.html">Metric spaces</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../topology/002-topological-spaces.html">Topological Spaces</a></li>
</ul>
</li>
</ul>
Expand Down Expand Up @@ -470,7 +471,7 @@ <h2>The score matching trick<a class="headerlink" href="#the-score-matching-tric
<p>The second step is to find a way to use the score function <span class="math notranslate nohighlight">\(\psi_\theta(x)\)</span> along with some observed data, to estimate the parameters <span class="math notranslate nohighlight">\(\theta\)</span>.
We can achieve this by defining the following score matching objective.</p>
<div class="proof definition admonition" id="definition-0">
<p class="admonition-title"><span class="caption-number">Definition 83 </span> (Score matching objective)</p>
<p class="admonition-title"><span class="caption-number">Definition 86 </span> (Score matching objective)</p>
<section class="definition-content" id="proof-content">
<p>Given a data distribution <span class="math notranslate nohighlight">\(p_d(x)\)</span> and an approximating distribution <span class="math notranslate nohighlight">\(p_\theta(x)\)</span> with parameters <span class="math notranslate nohighlight">\(\theta\)</span>, we define the score matching objective as</p>
<div class="math notranslate nohighlight">
Expand Down
Loading

0 comments on commit 7936a41

Please sign in to comment.