# Mathematics behind single input, multiple output regression

I have sought some help and trained a regression model that takes in a single dependent variable Y and gives the three independent variable R, B and G as output. This has been done in attempt to approximate a function : Y = R+B+G.

The neural network responsible for this is:-

    input1 = Input(shape=(1,))
l1 = Dense(10, activation='relu')(input1)
l2 = Dense(50, activation='relu')(l1)
l3 = Dense(50, activation='relu')(l2)
out = Dense(3)(l3)


But, this is done using Keras and tensorflow. As this model ran successfully, I now need to implement the same model (function approximation using regression). The problem can be solved using neural networks(as shown above) but there is no mathematical method of duplicating the solution without using any high level API.

How is the above neural network able to do this?

P.S: I need to understand the mathematics and logic behind the implementation.

• The best option I've seen for C++ implementation of ML techniques is MLPACK. If there are any others I would be happy to see them. mlpack.org/doc/mlpack-3.1.1/doxygen/anntutorial.html – RegressForward Sep 24 '19 at 18:31
• why do you need hidden layers? wouldn't you get the same performance without them (only with a single Dense(3))? I assume that optimal solution should have all biases equal to zero and each one of the 3 weights equal to 1/3 (R=G=B=Y/3). – itdxer Sep 27 '19 at 15:17
• The weights are to be determined by the neural network, it may seem simple to manually hard code the weights for such linear expression with all weights =1. But for different forms like Y= R+2B+G, it may be so simple, unless neural networks are used. – Pe Dro Sep 27 '19 at 18:00