This question is a tough one: How can I feed a neural network, a dynamic input?
Answering this question will certainly help the advance of modern AI using deep learning for applications other than computer vision and speech recognition. I will explain this problem further for the laymen on neural networks.
Let's take this simple example for instance:
Say you need to know the probability of winning, losing or drawing in a game of "tic-tac-toe".
So my input could be a [3,3] matrix representing the state (1-You, 2-Enemy, 0-Empty):
[2. 1. 0.]
[0. 1. 0.]
[2. 2. 1.]
Let's assume we already have a previously trained hidden layer, a [3,1] matrix of weights:
[1.5]
[0.5]
[2.5]
So if we use a simple activation function that consists basically of a matrix multiply between the two y(x)=W*x we get this [3,1] matrix in the output:
[2. 1. 0.] [1.5] [3.5]
[0. 1. 0.] * [0.5] = [0.5]
[2. 2. 1.] [2.5] [6.5]
Even without a softmax function you can tell that the highest probability is of having a draw.
But what if I want this same neural network to work for a 5x5 game of tic-tac-toe?
It has the same logic as the 3x3, its just bigger. The neural network should be able to handle it
We would have something like:
[2. 1. 0. 2. 0.]
[0. 2. 0. 1. 1.] [1.5] [?]
[2. 1. 0. 0. 1.] * [0.5] = [?] IMPOSSIBLE
[0. 0. 2. 2. 1.] [2.5] [?]
[2. 1. 0. 2. 0.]
But this multiplication would be impossible to compute. We would have to add more layers and/or change our previously trained one and RETRAIN it, because the untrained weights (initialized with 0 in this case) would cause the neural network to fail, like so:
input 1st Layer output1
[2. 1. 0. 2. 0.] [0. 0. 0.] [6.5 0. 0.]
[0. 2. 0. 1. 1.] [1.5 0. 0.] [5.5 0. 0.]
[2. 1. 0. 0. 1.] * [0.5 0. 0.] = [1.5 0. 0.]
[0. 0. 2. 2. 1.] [2.5 0. 0.] [6. 0. 0.]
[2. 1. 0. 2. 0.] [0. 0. 0.] [6.5 0. 0.]
2nd Layer output1 final output
[6.5 0. 0.]
[5.5 0. 0.]
[0. 0. 0. 0. 0.] * [1.5 0. 0.] = [0. 0. 0.] POSSIBLE
[6. 0. 0.]
[6.5 0. 0.]
Because we expanded the first layer and added a new layer of zero weights, our result is obviously inconclusive. If we apply a softmax function we will realize that the neural network is returning 33.3% chance for every possible outcome. We would need to train it again.
Obviously we want to create generic neural networks that can adapt to different input sizes, however I haven't thought of a solution for this problem yet! So I thought maybe stackoverflow can help. Thousands of heads think better than one. Any ideas?