# neural net architecture fails to approximate hybrid functions

I adopted a feedforward net to approximate the following hybrid function: $$output= \begin{cases} f(x,y) & \text{if}~~~ z=1\\ g(x,y) & \text{if}~~~ z=2 \end{cases}$$ where $x \in R,y \in R,z \in \{1,2\}$ are inputs. With a simple example where $f(x,y)=c$ and $$g(x,y)= \begin{cases} c' & \text{if}~~~ x<x_0,y<y_0\\ c & \text{otherwise} \end{cases}$$ I fed a set of data points generated from this example to the feedforward net. However, the feedforward net failed to approximate output correctly. Any insight why?

The feedforward net has one hidden layer of 50 neurons. The process is done in MATLAB and I used built-in MATLAB tools to update the weights of the neural net.

I also noticed if I use separate neural nets for each $z$ then each neural net is able to approximate $f$ and $g$.

• "Any insights?" Is not very objective oriented. The NN is not powerful enough to make separation, so it treats part of the data as noise. Perhaps nothing new, but I think that more focused question abou that would be better (either theoretical, or practical if you tell more about NN). – Evil Aug 24 '17 at 20:48
• What's the architecture of your neural network? How many layers? How many neurons? What activation function? etc. – D.W. Aug 25 '17 at 5:25