cazala / synaptic

architecture-free neural network library for node.js and the browser
http://caza.la/synaptic
Other
6.91k stars 666 forks source link

Basketball AI #81

Open tosbaha opened 8 years ago

tosbaha commented 8 years ago

Hi, I am trying to create an AI software to beat Facebook's Messenger basketball game. Below values are recorded for successful baskets.

BallX RimX RimY RimVelX RimVelY BallVelX BallVelY
0 0 -1.1 0 0 0 -957.7078352129345
-0.03739159564241917 0 -1.1 0 0 44.87289752680228 -1366.7902912724505
-0.12691505938168354 0 -1.1 0 0 48.80367766765175 -477.30991051862213
-0.081398887634964 0 -1.1 0 0 44.75530041779556 -853.2144450005378
0.133703061367537 0 -1.1 0 0 -127.0904223315372 -1091.7154870466916
0.02314529981529817 0 -1.1 0 0 0 -781.2962308147244
0.07290093279786697 0 -1.1 0 0 -22.50309417805242 -562.8674239226849
-0.07666526317561378 0 -1.1 0 0 67.31824067493115 -799.1426816168422
0.1696641842237867 0 -1.1 0 0 -127.66745002616335 -723.4386803154138
0.02281721710680884 0 -1.1 0 0 0 -716.6846158676678
0.3379265841707212 0 -1.1 0 0 -497.6375107061623 -1483.4331938602431
-0.2436980951520013 -0.18656860113143917 -1.1 0.2 0 202.42027069069786 -922.4516213764855
-0.11363666798852812 0.20565360069274927 -1.1 0.2 0 432.66459054881443 -864.9020445337759

I am trying to guess BallVelX and BallVelY from other 5 values. I tried to create a network with 5 input, 3 hidden and 2 output layers. However, it didn't give expected results. I guess it is due to negative values. I then tried to normalize the input and output training by adding some positive numbers and dividing to get a number between 0 and 1. Again this strategy didn't work as planned. I will really appreciate, if you can help me out. Thanks.

BallX: X Postion of Ball RimX: X Position of Rim RimY: Y Position of Rim RimVelX: Velocity of Rim on X axis RimVelY: Velocity of Rim on Y axis BallVelX: Velocity of Ball on X axis BallVelY: Velocity of Ball on Y axis

lucasBertola commented 8 years ago

Hi Indeed, activate function's parameters has to be a float between 0 and 1. So you can't have negative values and you can't have a value like "432". You have to normalize all your parameters.

See https://github.com/cazala/synaptic/wiki/Neurons for method informations And see https://github.com/cazala/synaptic/issues/72 for more informations about how to normalize your data.

I hope I helped you

chris-rcn commented 8 years ago

What? No. The inputs can be anything (but some types of normalization are often beneficial). The outputs are always going to be 0 to 1.