I'm currently training an agent to learn how to fight in a shooting game.

I'm using the bullet positions of the agent's opponent as one of the features. The features "don't exist" when the opponent isn't firing a bullet.

What should I substitute the feature with when the opponent of the agent doesn't fire a bullet? Right now, I'm considering using "0", but are there better alternatives?


1 Answer 1


Having to input a non-existing feature is a common problem in machine learning models. Entering 0 and 0 could mean the position { x: 0, y: 0 }.

But if you'd input "nothing", that still would be 0 (because nothing * weight = 0).

The best you can do is figure out what works best through trial and error. I could think of a few options:

  • If your network supports negative activation values (range: -1, 1), you should try to input it as -1.

  • I don't think the learning model will have a hard time if you'd just input 0 as input, like you proposed.

  • Add an extra input feature, 'bullet exists'. 0 if there is no bullet, 1 if there is a bullet. Then just input 0 for the x and y coordinates.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.