7 ms·
I hate to say it, but I’m not sure it’s playing fair. I used random.org to play truly randomly, and the “neural network” beat me to 10 pts 6 times in a row.
by QuadmasterXLII 7y ago
I hate to say it, but I’m not sure it’s playing fair. I used random.org to play truly randomly, and the “neural network” beat me to 10 pts 6 times in a row.
- QuadmasterXLII 7y agoLooking at the source code, the move you are about to make is included in the training dataset. This can be confirmed by playing “scissors scissors scissors rock” and then looking at the variables x and y in the console, which will include the surprise rock. The code updates x and y, then trains the model, and then makes a prediction. “Fair” code would make a prediction, then update x and y and train the model This explains the behavior mentioned in the comments where the computer gets an impressive early lead due to the players next move being one of only a few datapoints it learns from, then backs off to a more plausible advantage as the leaked data is diluted by past data.
- atum47 7y agoafter the player makes a move the nn makes ones and add it to it's training data. the move the player does after that is added as a counter move to the nn move. this way I treat the data as time series.
- atum47 7y agoI think it's fair, cause it's like the neural network is thinking "after I play rock the player plays paper" and train with that data
- j-pb 7y agoBut that's not what you're coding. If you trained it with every possible next move and response then you would learn that kind of relationship (though you would also overfit on the existing moves), but this way you just give it a peek into the probability distribution of the players moves, one thats so accurate that it comes from the future...
- akovaski 7y agoThe problem is that that the player's move is actually being fed to the training data before the computer makes its prediction. Take a look at the variable 'y' after making your move and you'll see that it includes the player's last move. Because 'y' is updated before the computer makes its prediction, this shows that the computer uses the player's current move as part of the training set to decide its move.
- klenwell 7y agoIf true, this seems like it would be a huge scandal. Or at least an issue in Github.
- GrumpyNl 7y agoIsn't this just plain cheating?
- atum47 7y agoit's not taking a pick at the player move. read the code, even after the pull request that brought this up the nn performed the same. even if the nn was taking a pick at the player's move, which is not, the data is shuffled before the training
- camjohnson26 7y agoI took a stab at fixing this: https://github.com/victorqribeiro/jokenpo/pull/3 https://github.com/victorqribeiro/jokenpo/pull/3
- seventytwo 7y agoWell, it’s much easier with your code. I immediately opened up a 3x lead on the comp. I stopped at 17-6-17 (W-L-T). What I did was to play the hand that would have beaten the computer’s previous guess, and if the computer looks like it’s figuring it out, I play the hand that beats my strategy once or twice, and then resume.
- scottlocklin 7y ago
- dTal 7y agoIn other words, the description is precisely inaccurate. Not only is it not untrained, it's trained against your exact plays through mysterious future-knowledge!
- jchw 7y agoThe thing is, if you are playing randomly, that makes it easier to predict what you’re (not) going to do next. A good random distribution would give fewer runs, which means your choice is less likely to be the last choice you picked and somewhat less likely to be other recent values. It can at least tie by choosing scissors if it thinks you will not pick rock. This is kind of a shot in the dark because I am not familiar with RPS strategy, but I think it makes sense.
- mbrumlow 7y agoBut if it predicts you are playing random, is it not then random vs random? I am under the impression that you can't game random -- unless you are aware of the random generator being used is broken..
- vinceguidry 7y agoIf you made random moves in a game of chess or checkers you'd get beat by a four year old with the barest grasp of the rules. In fact I would love to see a chess-playing robot that actually does that, it would thrill the crap out of my nephews to beat the big bad robot in a game of wits. I'm unaware of the name of the property that RPS exhibits that makes it ungameable by a random opponent (zero-sum?) but ordinary RPS played by humans certainly doesn't exhibit it, only in the magic world of computers where things like simultaneity of play can be guaranteed does RPS exhibit that property. If played in the real world like real humans traditionally played it, ongoing RPS matches between a human and an AI would soon see the AI dominating. I'd be very curious to see what real-world RPS would look like between two AIs that can 'explain their model'. Imagine making a rule that gives a Xms window for making plays. Then strategy can start to emerge.
- mbrumlow 7y agoThis is not chess. But a game of chance. You can't form a strategy based off random without predicting said random. I thik it was already pointed out but I have not had a chance to verify. This game uses your played move in tht training set to train before making it's predictions.
- mbrumlow 7y agoYeah, I am not sure what is going on, I just played it 1000 times from rand and the results were. 500 plays - Player: 144, Computer: 179, Tie: 177 https://youtu.be/g9Zo771HYpM https://youtu.be/g9Zo771HYpM 1000 plays - Player: 325, computer: 359, tie: 316 https://youtu.be/7pB5TZ_xYzE https://youtu.be/7pB5TZ_xYzE
- albertshin 7y agoHow are you emulating the clicking?
- mbrumlow 7y agoI normally write a c program or go linked to xlib to do this sort of work, but I just used xdotool in a bash script for this. https://gist.github.com/mbrumlow/49f0a3fa311cc3002e4e1fae2e290b3b https://gist.github.com/mbrumlow/49f0a3fa311cc3002e4e1fae2e2...
- albertshin 7y agothanks! didn't know about xdotool
- kojackst 7y agoThis runs it randomly 1000 times (well not reaaally randomly, but it gets close), just paste it into the browser console: const times = 1000; function sleep(ms) { return new Promise(resolve => setTimeout(resolve, ms)); } async function run() { for (let i = 0; i < times; i++) { await sleep(10); play(Math.floor(Math.random()*3)); } } run();
- mbrumlow 7y agoYou can also do: for(i=0; i<100; i++) { play(Math.floor(Math.random()*3)) } Right in the JavaScript console.
- 7y ago