AsciiDoc Example (source)

features.adoc

= AsciiDoc Example
:date: 2020-02-21 16:38:20
:toc_run: true
:publications_src: content/pages/zotero_single.bib
:status: hidden
:stem: latexmath

== Links

http://asciidoc.org/userguide.html[AsciiDoc Homepage])

== Table (Playing with Kaggle; uses AsciiDoc includes)

--- snip ---

include::../includes/ffe/table.adoc[]

--- snap ---

(1) augmented: one additional variant per image rotated randomly in [-5,5] degree. +
(2) bn: batch-norm 

== Mathematics

_Inline Math:_ stem:[f_{i}(x) = \int_{\tau(\pi)}^\infty e(x,y)dy]

_Display Math:_

[stem]
++++
\begin{bmatrix} 
a_{11} & a_{12} & \dots \\
\vdots & \ddots & \\
a_{n1} &        & a_{nn} 
\end{bmatrix}
++++

_Inline Math:_ stem:[(\Omega,\mathcal{F},P) \coloneqq (\Omega^+ \times \Omega^-,\mathcal{F^+ }\otimes\mathcal{F^- },P^+ \times P^- )]

_Display Math:_

The Wiener process in stem:[(\Omega,\mathcal{F},P)] is defined by

[stem]
++++
\omega(t) \coloneqq  
\left\{
    \begin{array}{cc}
        (\omega^+(t),0) & t\geq 0 \\
        (0,\omega^-(t)) & t<0
    \end{array}
\right.
++++

More math...

[stem]
++++
\tag {3.1a}
\begin{aligned}
    dy_t &= \sum_{i=1}^n \frac{x_t^i}{\|x_t\|^2} \left( \sum_{j=1}^n
    u_{ij} x_t^i\,dt + \sum_{k=1}^m \sum_{j=1}^n v_{ij}^k
    x_t^j\circ dW_t^k\right) + \cdots\\
    \cdots &+ \frac{1}{2} \sum_{i,j}^n \left( \frac{\delta_{ij}}{\|x_t\|^2} -
    \frac{2x_t^i x_t^j}{\|x_t\|^4} \right)\; \sum_k^m \sum_{l,p}^n
    v_{il}^k v_{jp}^k\, x_t^l x_t^p\;dt
\end{aligned}
++++

With stem:[z_t \coloneqq \frac{x_t}{\|x_t\|}] we get the following differential equation on the unit sphere:   

[stem]
++++
\tag{3.1b}
\begin{aligned}
    y_t &= y_0 + \int_0^t z_t^TUz_t- \|z_t\|^{-2}
    z_t^T\hat{V}\hat{V}^T z_t + \frac{1}{2}\text{ trace
    }(\hat{V}\hat{V}^T)\,dt +\cdots\\
    \cdots &+ \sum_{k=1}^m \int_0^t z_t^TV^kz_t\circ dW_t^k
\end{aligned}
++++


=== Outline as partial TeX file inclusion

Line block - takes only the inner part of a LaTeX display-math environment by specifying row delimiters for the included LaTeX file:

--- snip ---
[stem]
++++
include::../includes/ffe/formulas.tex [lines=6..12]
++++
--- snap ---

Single line (as inline): start include -> stem:[
include::../includes/ffe/formulas.tex [lines=16]
] <- stop include


== Footnotes

Footnotes are possible, like using footnote:[First footnote] and footnote:[Second footnote].

== Citations

- Cited text 1: [@@touchetteBasicIntroductionLarge2012]
- Cited text 2 footnote:[Interesting in terms of content, by the way]: [@dematteisRogueWavesLarge2018]

== SVG image
// Disable all captions for figures here ('Figure 1' prefix). But in general AsciiDoc
// seems to be the most versatile format for images and figures
:!figure-caption:
[.left.text-center]
image::{static}/images/neuron.svg[title="Caption (Neuron image - 50%)", width=50%]

== Code

=== Verbatim file inclusion

[source]
----
include::../includes/ffe/features.py[]
---- 

=== Normal code block

....
from torch.utils.data import TensorDataset
from torch import Tensor, LongTensor, FloatTensor


def loadData(path) -> Tuple[np.ndarray, np.ndarray]:
    '''
    Load data from kaggle mnist set.

    path -- input csv

    Return scaled images [0,1] and labels (if available)
    as numpy arrays (dtype: float32, int64)
    '''
    # Read
    df = pd.read_csv(str(path))  # 40.000 entries
    # tdata = pd.read_csv(data_raw_dir + sep + 'train.csv') # 28.000 entries

    has_labels = True if 'label' in df.columns else False
....

Some `inline code`.

table.adoc

[width="100%]
|=======
|      Model      | Epochs | bs  | lr     | Momentum | Result (local) | Result (Kaggle) | Remarks       

|    SimpleNet    | 50     | 20  | 0.007  | 0.9      | ~97            |                 |              
|     ConvNet     | 50     | 25  | 0.008  | 0.9      |                | 99.257          |              
|        "        | 50     | 17  | 0.008  | 0.9      | 99.1964        |                 | augmented    
|        "        | 50     | 17  | 0.008  | 0.9      | 99.3143        | 99.342          | augmented bn
| Binary Ensemble | 25     | 17  | 0.007  | 0.9      | >99            |                 |              
|        "        | 22     | 17  | 0.0085 | 0.9      | 99.23928       | 99.328          | augmented    
|        "        | 22     | 17  | 0.0085 | 0.9      | 99.34643       | 99.357          | augmented bn 
|=======

formulas.tex

\documentclass{article}
\usepackage{amsmath}

\begin{document}
\[
\begin{aligned}
    z &= z(x, y)\\
    x &= x(s_1, s_2)\\
    y &= y(t_1, t_2)\\
    s_i &= s_i(w) \; \forall i \in \{1,2\} \\
    t_i &= t_i(w) \; \forall i \in \{1,2\} 
\end{aligned}
\]

\[
{\partial z\over\partial w}={\partial z\over\partial x}\cdot\Bigg({\partial x\over\partial s_1}\cdot{\partial s_1\over\partial w} + {\partial x\over\partial s_2}\cdot{\partial s_2\over\partial w}\Bigg) + {\partial z\over\partial y}\cdot\Bigg({\partial y\over\partial t_1}\cdot{\partial t_1\over\partial w} + {\partial y\over\partial t_2}\cdot{\partial t_2\over\partial w}\Bigg)
\]

\end{document}