If a neural network is a function f that maps x to y, how can I formally define a neural network with multiple outputs

definitionmachine learningneural networks

Formally I can say that a simple neural network can be formally defined as enter image description here where D is the size of the input vector x and L the size of the output vector y. So I can say that $y = f(x)$. But how do I define this for a more complex model that have multiple inputs and outputs. For instance, consider such a network:

enter image description here

It consists of three inputs $x_1, x_2, x_3$ and two outputs $y_1, y_2$. How do I formally describe that network?

Is $f(x_1, x_2, x_3) = \{y_1, y_2\}$ a formally correct way?

Or would I better say that neural network $f$ cosnists of several branches for every output? So that I would define a seperate function that maps its input to the output. Such that my neural network $f$ is defined by the following two functions: $f_1(x_1, x_2, x_3)=y_1$ and $f_2(x_1, x_2, x_3)=y_2$.

I can not find any source who defines a neural network with multiple output in such a formal way. Thanks for your help!

Edit: $y_1 \in R$ and $y_1 \in R^4$

Best Answer

Both ways are good. Using $f_i$ is useful for computing derivatives, errors, etc.

Using just $f$, you'd better switch to vector notations, meaning that $f$ is a function from a vectorial space to another.

Usually, to encode the inputs and output in a machine, you always use vectors of number (for example, a picture is just a vector of pixel intensities, or a string is just a sequence of ASCII codes). In this sense, if $x_i\in\mathbb R^{n_i}$, then you can see the input $(x_1,x_2,x_3)$ as a vector in $\mathbb R^{n_1+n_2+n_3}$ and analogously, if $y_i\in\mathbb R^{m_i}$, then you can see the output $(y_1,y_2)$ as a vector in $\mathbb R^{m_1+m_2}$. In this case, $f$ is a function between vectorial spaces $$ f:\mathbb R^{n_1+n_2+n_3}\to \mathbb R^{m_1+m_2} $$

Related Question