I am trying to train a neural network to be able to shoot a bubble accurately. My solution is to have a brain inside the “arrow” and make it determine the shooting “angle” based on the scores it receives. I have followed all the instructions given by Daniel Shiffman. However, it seems my neural network can’t learn any thing for some unknown reasons!
Please let me know if I did something wrong. Here is the code:
hi! The project looks nice! But your project seems quite huge (for someone to take a look and spot an issue) and it would be helpful if you can elaborate the problem a bit more - for example, why do you think it cannot learn? Is it based on your observation? Which video/material of Dan do you refer to? Genetic algorithm may not be the most efficient way to train a model, so you may need to wait for some iterations.
Thanks for your reply!
Regarding this project, I was hoping to find out if the inputs and outputs that I defined for the “arrows” are correct. So the “arrow.js” file is the critical file to look at. I copied all other neural net and genetic algorithm scripts from “p5.js Web Editor” which is developed by Daniel and works perfectly. Based on my observation, after a number of generations there should be an arrow to stay in the scene and hit balloons. My policy is to reposition the arrows that hit the balloons on the top origin point and dispose other unsuccessful arrow. So the arrow with the best performance should be able to hit a balloon and appear in the origin base iteratively
yes I remember this example! I can only give you a high level comment, which I suggest taking a look at the guideline
What I noticed in you code is that you changed basically two major things - you are using tensorflow.js which doesn’t seem to be included in Dan’s example (or does he have another example that uses tf?), and you changed the “game” itself from the flappy bird to balloon popping. So, first it’s important to separate them to see which is actually causing the issue (the neural net or the game logic, or it can be both of them)
Yes, admittedly I need to pin point the problem better than this. However, I really don’t know what is the problem! Regarding the tensorflow.js, Daniel did this in this example and I followed his guidelines. I think my game mechanics is causing the problem.
I see! I don’t know this is helpful, but I noticed that your game actually is dependent on other pins - a pin chases a balloon but it can be popped by another one before it reaches. This doesn’t happen in Dan’s example because the walls are not affected by other birds. This may be making the learning more difficult - what if you make the balloons not going to disappear even though they are popped by other pins, to see if the learning becomes more efficient?
Very good point! Yeah, I didn’t think about this issue. If fact when I increased the number of balloons and decreased the number of pins the learning rate improved! I am going to keep the balloons in the scene and let you know the outcome Thank you very much!