dfs-with-r / coach

Lineup optimization for daily fantasy sports
https://dfs-with-r.github.io/coach/
GNU General Public License v3.0
46 stars 14 forks source link

trying to build custom model #41

Open smellycat21 opened 1 year ago

smellycat21 commented 1 year ago

Hey guys, trying to build this out for a custom model not currently available, is there a step by step into building my own?

thanks!

zamorarr commented 1 year ago

Hi @smellycat21. There is no guide for building your own custom model yet, but I can answer any questions you are having. You can also take a look at the source code for some of the models for inspiration: https://github.com/dfs-with-r/coach/blob/master/R/fanduel-nba.r

smellycat21 commented 1 year ago

thanks!

a few questions:

What is the easiest way to lock or remove a player from the pool in R? Also is there a way to set a maximum exposure for certain players? Is there a way to reduce the players projection after every lineup they've been selected in? How does the randomness number compare to a %?

Sorry, I am new to this and im sure i will have more going fwd!

Really appreciate your help!

zamorarr commented 1 year ago
  1. To lock or ban a player from the pool, you can set the lock and ban parameters of the optimize_generic() function. For example, optimize_generic(data, model, bans = c(3, 10), locks = c(1,2)) would ban the 3rd and 10th players in the data and lock the 1st and 2nd.
  2. Similarly, you can set the max_exposure parameter` of the same function. It accepts either one value that will apply to every player, or a vector of values - one for each player. There is some more info in the README
  3. There is no way to reduce the projection after every lineup currently, though that might be a good feature to add in the future.
  4. The randomness parameter actually accepts a function that will be applied the fpts_proj column in the data. There is some more info in the README as well. So for example to add a random noise that is Normally distributed around the fpts_proj value, with a standard deviation of 10 you would do this:
n <- nrow(data)
my_fun <- function(x) rnorm(n, x, 10)
optimize_generic(data, model, randomness = my_fun)

Hope that helps get you started. Let me know if you have any other questions.