How to define an Artificial Neural Network as a function

68 Views Asked by At

I want to define feed-forward ANN as a function in a clean mathematical way and as accurately as possible. I can do something if I fix the number of layers, but I would like to generalize it for any number of layers (possibly without using "$\dots$"). Here is roughly what I have done:

Let $F$ be the ANN, $x \in R^{input}$ be the its input and $F(x) = y \in R^{output}$ its output. Let $f_i: R^{m_i} \rightarrow R^{m_i}$ be a generic activation function applied to the dot product between the weight matrix $W_i$ of layer $i$ and the layer input. $m_i$ is the number of outputs of layer $i$

$$ F: R^{input} \rightarrow R^{output} \\ F(x) = f_3(W_3 \cdot f_2(W_2 \cdot f_1(W_1 \cdot x)))$$

Can you find a better way?

1

There are 1 best solutions below

6
On

The $(\ldots)$ notation in mathematics usually stands for informal placeholder for recursion/induction. In the ZF axiomatic set theory there's a theorem called "The recursion theorem" that tells you when such recursively defined functions exist. If you want to be mathematically rigorous you can define $$F_0 (x) = f_1(W_1 \cdot x)$$ $$F_{n+1} (x) = f_{n+2}(W_{n+2} \cdot F_n(x))$$ Then if the number of layers is $l$ you can set $F = F_{l-1}$.