zachmayer / kaggleNCAA

Simulate the NCAA tournament based on a kaggle-format bracket (with predictions for every possible matchup)
Other
39 stars 12 forks source link

Add a function to simulate a single instance of a tournament #6

Closed sfirke closed 5 years ago

sfirke commented 6 years ago

Sorry if I missed this and it's already in your package. My use case would be to take my Kaggle probabilities and play out the tournament one time. Then I use this to make a bracket for a traditional pool.

That way I get about the "right number" of upsets. Vs. simulating 100s of times in which case there end up being no upsets. And if I keep tinkering with set.seed() I can get a bracket I like as well, e.g., doesn't have a despised team winning it all.

I built a file to do this last year: https://raw.githubusercontent.com/sfirke/predicting-march-madness/master/scripts/kaggle_submission_to_bracket.Rmd. You can see a screenshot of the output here: https://www.kaggle.com/c/march-machine-learning-mania-2017/discussion/30055

I had been thinking about putting it on a Shiny app for people to upload their predictions to.

But if you'd be up for adding that functionality to your package, that's probably a more robust home for it. And your output format looks better. And if you're already simulating many instances of a tournament, I bet simulating one and printing a bracket would be relatively easy - I hope?

zachmayer commented 5 years ago

Try this:

library('kaggleNCAA')
dat <- parseBracket('seed_benchmark_men.csv', w=0)  # w=0 for men
sim <- simTourney(dat, 1, progress=TRUE, w=0)  # w=0 for men
bracket <- extractBracket(sim)
printableBracket(bracket)

You may find that using 1 simulation gives too many upsets— I like the results I get from ~5 simulations.

sfirke commented 5 years ago

Works for me, thanks Zach!