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

Example please #35

Closed Grayhawk34 closed 2 years ago

Grayhawk34 commented 2 years ago

Hi, I'm trying to add bans to the optimization process. Can you please show how you are suppose to do this? The below doesn't work.

results <- optimize_generic(data, model, L = 5, max_exposure = 0.5, stack_sizes = 3, stack_teams = c("DAL","LAC","BUF"), bans = c("68179-79920"))

zamorarr commented 2 years ago

Hi @Grayhawk34. You will need to put a single id or vector of ids in the bans parameter. So something like c(1, 2, 10). Note that is referring to the row_id, not the player_id.

You can look at the data frame to find out which row_ids correspond to the player_ids you want to ban. For example, to find out which row_ids you need for that player you can do this:

library(dplyr)
df %>% filter(player_id == "67822-9646") %>% pull(row_id)

Does that help?