Reputation: 91
Is there any way to design a neural network where if I train it on x (input) and y (output) dataset arrays of length n each, then it can even predict an output if the input given is of length m with an expected output of length m as well? Such that m ≠ n.
My current set up is where I train a MLP regressor from Sci kit learn and using it predict arrays when given input x of length n, same as the training set. However, using the same predictor I would like to be able to predict arrays when the input is of a longer or shorter length than the training set. If there is a way to implement this any guidance will be appreciated.
Upvotes: 1
Views: 1069
Reputation: 895
That's a classic issue in text application (NLP), you should look in that direction to make research.
For example:
-you can use padding: choose a length N>n,m. Then add zeros at the end of each trainset instances until they are of size N. During inference you can add 0 to instances until they are of size N, this way any input of size [0,N] is covered.
-you can use LSTM (reccurent newtork) that will work on any input length.
...
Upvotes: 1