Markdown Example (source)

features.md

Title:  Markdown Example
Date: 2020-02-21 16:19:46
publications_src: content/pages/zotero_single.bib
toc_run: true
Status: hidden

## Links

[Markdown quick reference](https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet)

## Table (Playing with Kaggle; uses Markdown includes)

--- snip ---

{! includes/ffe/table.md !}

--- snap ---

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


## Mathematics

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

_Display Math:_

$$
\begin{bmatrix} 
a_{11} & a_{12} & \dots \\
\vdots & \ddots & \\
a_{n1} &        & a_{nn} 
\end{bmatrix}
$$

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

_Display Math:_

The Wiener process in $(\Omega,\mathcal{F},P)$ is defined by

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

More math...

$$
\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 $z_t \coloneqq \frac{x_t}{\|x_t\|}$ we get the following differential equation on the unit sphere:   
   
$$
   \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 ---
$$
{! includes/ffe/formulas.tex [ln:6-12] !}
$$
--- snap ---

Single line (as inline): start include ->
$
{! includes/ffe/formulas.tex [ln:16] !}
$
<- stop include

## Footnotes

Footnotes are possible, like using [^1] and [^2].

[^1]: First footnote  
[^2]: Second footnote

## Citations

- Cited text 1: [@@touchetteBasicIntroductionLarge2012]
- Cited text 2[^3]: [@dematteisRogueWavesLarge2018]

[^3]: Interesting in terms of content, by the way


## SVG Image

Embedded using Markdown extension (*attr_list*) and table (for caption):  

||
|:-:|
|![Neuron image scaled]({static}/images/neuron.svg "Neuron image - 80%"){: style="width:80%"; class="align-center"}|
|Neuron image - 80%|

## Code

### Verbatim file inclusion 

```
{! 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.md

|      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}