Programming Pokemon Battle Predictor: A Working Machine Learning Browser Extension

Yes, I'm sure. It takes some time for extensions to be updated as it's an automatic process on the user's end. You may have to restart Chrome or give it a day or two to update.
Even in chrome's webstore, it still says that the last update was at 24/8/2020...
 

Lionyx

メラミ
is a Battle Simulator Administratoris a Community Leaderis a Smogon Media Contributor Alumnus
PS Admin
Hey, that's an interesting project! Here are some things that I noticed while testing it out in Gen 4 OU :
- after the first turn of an opponent's Outrage, the AI still predicted a chance to switch and a change to use another move, only giving Outrage a ~50% chance to be used next when the opponent could actually not switch nor use another move (so, it should have shown a 100% chance for Outrage to be used)
- since this generation does not have team preview, the switch chance calculates the chance of switching-in for the revealed Pokémon only (for example, I had Metagross on the field, the AI predicted a 92% Lucario/8% Azelf chance for a switch, while the opponent actually had an unrevealed Zapdos). I believe that it could be confusing for players who aren't very familiar with the metagame
 
QQ截图20200830170546.png

Also, Eldegoss seems to have too high priority. During the entire game, it keeps saying he will most likely switch to Eldegoss (much greater than all the other combines!).
 
Update: Gen 8 September Update

The update is under review for Chrome and Firefox right now, but when it's out it includes an updated models for all the gen 8 tiers to based on usage data from August. This includes adding proper support for Zarude.

Thanks for telling me about all of the bugs, but I've been a lot busier recently than I would've liked to have time to fix them. Hopefully I can find a time this week to iron those out.
 
Some pokemon (like Eldegoss which I mentioned above), if present in a specific format, the predicted will almost always predict them to be having the highest switch priority. I personally will guess that it's due to how rarely they are used and there is very few battle record of using them, which result in overfitting. Maybe this can be solved by deliberately searching battles that contain those rarely used pokemon.
just maybe...
 
I just downloaded the extension and it appears not to work, I have tried using it in gen 7 OU, Gen 8 OU and gen 5 OU. It also does not show chance to win in replays, I am using the chrome version.
 
Update: AND WE'RE BACK!

It's been a while, but this project is officially back online! First things first, let's talk about what's in the latest release (which is available now in the usual places)
  • It works again (but more specifically it's been updated to accommodate the changes to how Showdown's website works since last time)
  • Support for the current (and future) gen 8 singles metas updated
  • General reliability improvements to prevent crashes and hiding the crashes when they do happen
  • Overall bump in model accuracy and confidence; all models for gens 1 - 7 have >80% accuracy with an average of 88% and all models for gen 8 have >75% accuracy with an average of 83%
On your end the functionality won't look all that different, but this took me so long because a LOT has changed on the backend. Basically I discovered that my old model creation code was glitch city and while rewriting most of it, I ended up changing so much of how things work that the explanation I gave at the start of this thread is woefully obsolete. The good thing is that time seemed to pay off as now the models produce far more stable results than before (although a weird prediction every now and then is inevitable), so hopefully people can find good use out of it again.

Because I changed the models so much, they ended up being much bigger than the old ones, so including them all made the extension surpass the 2GB size limit. This means I have to run the models on a server and send the predictions back to you. All the data - including only the current state of the battle, your team, and the previous turns - is completely anatomized (the JavaScript savvy among you can verify this by inspecting the extension's code and see it uses the same method as Showdown) and only used for the models and making sure it's all working. I just wanted to mention this clearly in case functionality like that is something you want to avoid.

The good news is that brings a ton of advantages too! I said "and future" metas because with the models hosted in the cloud, I've set them up so they automatically update every 2 weeks to reflect tier changes and the like, so outside of a drastic change to how Showdown or the battle system works, the extension will always be up to date. Also, it's going to be much easier to address bugs that come up on the prediction side as now I can fix them individually and instantly instead of waiting to group them into an update.

I'm currently preparing a whole explanation about how this and the accompanying AI works, but in the mean time I can't decide whether to tackle random battles or double battles next. On one hand random battles are easier to predict and the most popular format, and one the other double battler's could find a lot more use out of this. If you have any recommendations I'm all ears and I'll keep y'all posted one which one I choose.
 

Plague von Karma

Banned deucer.
  • Overall bump in model accuracy and confidence; all models for gens 1 - 7 have >80% accuracy with an average of 88% and all models for gen 8 have >75% accuracy with an average of 83%
I was wanting to test this on Gen 1 OU, but it doesn't seem to come up? I've tried hard resetting Chrome, reinstalling the extension, etc, but no dice.
 
I was wanting to test this on Gen 1 OU, but it doesn't seem to come up? I've tried hard resetting Chrome, reinstalling the extension, etc, but no dice.
That's odd, it seems to all be working when I try. Are you using it on a replay or lie battle? Also, make sure in the settings - you can find when clicking on the extension's icon - the prediction types are checked:
1615399361494.png
 
Is rating also an input to the programme? The AI seems to significantly underestimate the chance of people using stealth rock when you have a magic bounce pokemon, or at least in the lower part of the ladder.
 
Is rating also an input to the programme? The AI seems to significantly underestimate the chance of people using stealth rock when you have a magic bounce pokemon, or at least in the lower part of the ladder.
I do have models specially for different rating levels, but I didn't implement them into the predictions you are seeing. This will be done at some point, but that functionality wasn't a priority. Most of my data, (particularly for gen 8), is favored for those higher on the ladder , so it makes sense the AI assumes the player would be cautious with rocks when magic bounce is a thing.

Have you tried to analyze the composition of moves that AI failed to predicts?
Yep, another advantage of making it server-based now!
 

Plague von Karma

Banned deucer.
That's odd, it seems to all be working when I try. Are you using it on a replay or lie battle? Also, make sure in the settings - you can find when clicking on the extension's icon - the prediction types are checked:
1615830453972.png

Yeah, nothing really happens regardless of battle or replay. Here's a screenshot from the replay thing, where nothing shows up the entire game.
 
View attachment 323454
Yeah, nothing really happens regardless of battle or replay. Here's a screenshot from the replay thing, where nothing shows up the entire game.
I see the issue. The battle is labeled as "OU Monotype" rather than "[Gen 8] Monotype". That label (or really the data that creates the label) is what the extension uses to figure out if the battle is in a supported format, and since I only have "[Gen 8] Monotype" in the system, the battle you have there won't be predicted on. Is there a difference between the two formats, because if not I can add support for it pretty quickly?
 

Plague von Karma

Banned deucer.
I see the issue. The battle is labeled as "OU Monotype" rather than "[Gen 8] Monotype". That label (or really the data that creates the label) is what the extension uses to figure out if the battle is in a supported format, and since I only have "[Gen 8] Monotype" in the system, the battle you have there won't be predicted on. Is there a difference between the two formats, because if not I can add support for it pretty quickly?
OU Monotype was an old way of putting it iirc, I don't think it's necessary. Could be an alias?

Even in the case of other formats, nothing changes, at least for Gen 1 OU.
1615831890294.png
 
Slightly unrelated, but while working on my AI that uses this project, I figured out how to do reverse damage calculation - i.e. you put in how much damage you did/took and it returns your opponent's set or sets that could result in this. Since it's an AI for a game, the more attacks done by/to that opponent the narrower the guess gets. I guess outside of battle it could used to say "Give me a set that can do this much damage from that, take this much damage from that, etc", but I'm not much of a team builder and don't know if that's something people would do. Would a tool like that be useful to people?
 

Aqua Jet

Boba Bitch
is a Contributor to Smogonis a Community Contributor Alumnus
Slightly unrelated, but while working on my AI that uses this project, I figured out how to do reverse damage calculation - i.e. you put in how much damage you did/took and it returns your opponent's set or sets that could result in this. Since it's an AI for a game, the more attacks done by/to that opponent the narrower the guess gets. I guess outside of battle it could used to say "Give me a set that can do this much damage from that, take this much damage from that, etc", but I'm not much of a team builder and don't know if that's something people would do. Would a tool like that be useful to people?
I've actually been thinking about something like this for awhile but due to my lack of technical knowledge I've been unable to see it through. Somthing like this would be pretty useful, especially for Balance teams because they could use their walls to narrow down the possible EV's as well as their Nature and from there assume the foes defensive stats.
 
Hi,
I read your whole thread and everything is interesting in it.

You mentionned you worked on an AI based on this idea, which I had some ideas about.
I thought about a way for the player controlling the AI to « paste » the 12 (6v6 battle) Pokemon’s movesets, including items, abilities and spread details directly into a kind of pokepaste feature (see :PokePaste) ) directly in the AI's system.

Obviously, implementing this idea would need to make pokemon / moves / spread / abilities and item files so that the AI can indeed read what the player wants him to play with / against.

I also thought about the extend of the number of pokemons / moves / items / abilities that would need to be implemented.
To be honest, we wouldn’t need more than :
~ 60 pokemons
~ 90 abilities (concerning those 60 pokemons, only some of them has more than 1 competitively viable ability that needs to be taken in count such as clefable with unaware / magic guard)
~ 200 different moves
~ 15 different items
~ 10 different natures
~ 80 different spreads (note : only fixed spreads could be taken in count to lessen the number of spread varieties we could encounter).
All this only concerns the actual SS OU tier, I could eventually make a more detailed list about that if needed.

The idea behind this is simple :
The player could simulate a closed room where he choses the 12 pokemons and all their parameters.
After which the AI will run through many simulated game attempts against the correct team so that he then finds the best solution / gamepath to the win regarding the opposite Matchup (he should come up with a series of play that beats at 100% certainty (or close due to random in-game factors).
The player would then only need to make the same plays the AI did by looking the AI’s replays / choices depending on the situation (indications could be shown as it already is in your actual prediction system).

I though don’t know how much time it would need for such an AI to find the best gamepath and then show it to the concerned player, even with limited and chosen parameters, but even if it takes long, it would definitely be the best way for a player to test his team against any MU he wants.
What do you think ?

NB : Your prediction system doesn't seem to work any longer atm.
 
Last edited:

Users Who Are Viewing This Thread (Users: 1, Guests: 0)

Top