# Neural networks with not-fixed dimension for input and output

I would like to know if it exists a model/method which can deal with input and output of different dimension.

For example, let us say that the maximum number of info we could have is 6 features and 5 output. Then I could have examples with 4 features and 3 output.

Less input features always relates to less output. And relations stays the same. with only 4 features I have only 4 outputs, and so on.

Most important, it is not that I do not have them for missing knowledge, but because in the same problem dominion I could have all 6 of the features, or less.

It is possibile to create a model which deal with this kind of things ?

The other solution I thought was to just use a simple deep network, with the maximum number of features and output as dimension, and use a value = 0 when I have a missing feature or a missing target. But that destroyed completely the training performances

## 1 Answer

If youre searching for neural network architecture that have varying number of inputs and outputs, Recurrent Neural Networks, LSTM's .. etc are examples. They are used in Natural Language Processing where the main goal is to examine patterns in sentences. But I highly doubt that they will work for your use case since no information about it is provided.

Another way would be to create multiple neural networks with a different input/ output sizes, such that the input/output sizes are averages of the groups of similar input/output sizes.

• Thank you! I was leaving the multi-NN solution as last hope, maybe betting on something more elegant. Just in a few words, my problem concerns geometry information. Think of it as a chessboard, I have internal nodes with a maximum number of neighbours (thus, max features and target), while going on the border they becomes less. Hope this helps a bit to understand the problem. What I'm doing is somehow a multi-target regression based on geometry information of each node
– Cla
Nov 12 '20 at 13:38
• @Cla Glad to hear that my answer helps you! Based on the analogy youve provided does that mean that the external nodes are few in number may be its because of that imbalance that substituting with zero is not working out for you. If thats the case it would better to use your previous NN but with an improved dataset containing duplicates or possibly statistically created additions of those external node data. Nov 12 '20 at 13:43
• So you're saying it is a metter of biased training set. And it actually makes sense. I just thought that the 0-value wasn't working because of the back propagation: when I optimize my weights until the input layers, starting from the error in output, I could put a weight whatsoever related to inputs which have 0 values, but it will not change its "support" in the forward phase. Do you think is a wrong thought ?
– Cla
Nov 12 '20 at 13:46