Wilco
Wilco

Reputation: 23

Neural Networks - How best to deal with a variable number of inputs

For a multi-agent formation problem I want to use an Artificial Neural Network (ANN) which should output a desired velocity vector (x,y) based on the relative positions of neighbouring agents in view, either in (x,y) or (angle, radius) whichever will work best I guess.

The number of agents in view is variable since they only have ~150 degrees field of view.

How could I best deal with the variable number of inputs to the ANN? I would love some input on the best approach.

The only way I can think of is to limit the number of possible inputs and then either input only the closest neighbours when exceeding the limit or fill the empty inputs with fake neighbours far away (since distant interaction is very limited).

Upvotes: 2

Views: 2033

Answers (1)

Kate66
Kate66

Reputation: 92

Generally you can build your network with more inputs than you need. The important part is to make sure that your training data matches the usage data.

You can have a method where you simply input 0,0 for unused vectors, or you can make each input like x,y,0 where the last number is 1 if the vector should be used or not. The important thing is to just use lots of training data and make your real-world usage match the training format.

Inputs that aren't used or useful will tend towards zero weight in actual operation.

There are also more advanced methods where you take the output and loop it back into the input, then give one additional input on each iteration. That's probably overkill for what you're doing though.

Are you using reinforcement learning? Or supervised?

Upvotes: 3

Related Questions