# How to train this neural network?

I seek the neural network (NN) which satisfies the 100 equations (i=1,2...100)

$$\sum_{j=1}^{2000} NN(A_{ij},B_{ij},C_{ij})=Q_i$$.

Where A,B,C are 100x2000 matrices

So I know Q, A, B and C How can one find the NN? (ie train it using this data) I have a second datset to test it on. I also have MATLAB neural network toolbox, but that is not a necessity for me to use that.

• Questions about specific software packages are off-topic here. – Yuval Filmus Feb 18 '19 at 11:11
• Is your neural network out of the ordinary? If so, can you explain in what way? Otherwise, you train the network just you train any other network. – Yuval Filmus Feb 18 '19 at 11:11
• But I dont have a target, I only have sums of targets. – badmf Feb 18 '19 at 11:12
• I don't really understand your question – in your first equation, the network has a single parameter, and in the second, two parameters. Are you talking about two different situations? Also, it seems like you can find a linear function NN satisfying your constraints (if at all possible) by solving linear equations. So neural networks aren't really needed at all. – Yuval Filmus Feb 18 '19 at 11:17
• Two situations. This function is not linear. – badmf Feb 18 '19 at 11:19

## 1 Answer

Let $$w$$ denote the weights of the neural network. Define the objective function $$\Psi$$ by

$$\Psi(w) = \sum_i \left(\left(\sum_j NN_w(A_{ij},B_{ij},C_{ij})\right) - Q_i\right)^2.$$

Then, find $$w$$ that minimizes $$\Psi(w)$$ using gradient descent. You can find the gradient of $$\Psi(w)$$ using backpropagation through the neural network. You can use all the standard methods for speeding up training of neural networks: stochastic gradient descent, Adam or momentum or Adagrad, etc.

This is very similar to training neural networks for regression problems. The only difference here is that you are summing the output of the neural network on multiple inputs. It is straightforward to adjust the objective function to take that into account, as shown above.