Closed NahomKun closed 2 years ago
I can't reproduce the problem -- I think your example has an error in it (you're running build_lineups
on opt
, but defining your constraints on dkopt
.
Here's what I ran -- it's identical to your example, except the lineups are using dkopt
to build:
dkopt <- create_optimizer(site = 'DraftKings',
sport = 'BASKETBALL',
contest_type = 'CLASSIC')
df <- read.csv('./df.csv')
dkopt <- add_players_from_df(object = dkopt, df = df)
min <- get_player_id(dkopt,'Cam Reddish') #SG/SF
min2 <-get_player_id(dkopt,'Willy Hernangomez') #PF/C
min3 <-get_player_id(dkopt,'Delon Wright') #PG
min4 <-get_player_id(dkopt,'Saddiq Bey') #SF/SG
min5 <-get_player_id(dkopt,'LeBron James') #SF/PF
dkopt<-dkopt %>%
lock_players_by_id(min) %>%
lock_players_by_id(min2) %>%
set_player_min_exp(id= min3, exp= .2) %>%
set_player_min_exp(id= min4, exp= .4) %>%
set_player_min_exp(id= min5, exp= .4)
lineups2 <- build_lineups(dkopt, num_lineups = 150)
summary(lineups2)
And here's the output
Number of Expected Lineups: 150
Number of Lineups Found: 150
Player Exposures:
Player Lineups Percent
1: Cam Reddish 150 100.0000000
2: Willy Hernangomez 150 100.0000000
3: Tyler Herro 136 90.6666667
4: Saddiq Bey 102 68.0000000
5: Jalen Brunson 82 54.6666667
6: Seth Curry 78 52.0000000
7: Deandre Ayton 69 46.0000000
8: LeBron James 60 40.0000000
9: Franz Wagner 44 29.3333333
10: Bradley Beal 43 28.6666667
11: Dewayne Dedmon 41 27.3333333
12: Delon Wright 30 20.0000000
13: Brandon Ingram 30 20.0000000
14: Josh Hart 29 19.3333333
15: JaVale McGee 27 18.0000000
16: Duncan Robinson 15 10.0000000
17: Hamidou Diallo 14 9.3333333
18: Myles Turner 13 8.6666667
19: Monte Morris 10 6.6666667
20: Julius Randle 9 6.0000000
21: Gabe Vincent 7 4.6666667
22: Jordan Clarkson 7 4.6666667
23: Keldon Johnson 6 4.0000000
24: Max Strus 6 4.0000000
25: Kyle Lowry 5 3.3333333
26: Desmond Bane 4 2.6666667
27: Kyle Anderson 4 2.6666667
28: Tyus Jones 3 2.0000000
29: Caris LeVert 3 2.0000000
30: Tobias Harris 3 2.0000000
31: Mikal Bridges 3 2.0000000
32: Malik Beasley 3 2.0000000
33: Dorian Finney-Smith 2 1.3333333
34: Joel Embiid 2 1.3333333
35: Aaron Gordon 1 0.6666667
36: Steven Adams 1 0.6666667
37: Cameron Payne 1 0.6666667
38: Bojan Bogdanovic 1 0.6666667
39: Onyeka Okongwu 1 0.6666667
40: Gary Harris 1 0.6666667
41: Nickeil Alexander-Walker 1 0.6666667
42: Devin Booker 1 0.6666667
43: Kevon Looney 1 0.6666667
44: Donovan Mitchell 1 0.6666667
Player Lineups Percent
Players Per Team:
ATL DAL DEN DET GS IND LAL MEM MIA MIN NO NY ORL PHI PHO SA UTA WAS
181 84 11 116 1 16 60 12 210 3 210 9 45 83 101 6 9 43
Lineup Variance (mean Jaccard Distance): 58.11 %
the optimizer doesn't lock the players to lock nor does it construct lineups with players with the minimum amount of player exposure df.csv code: `dkopt <- create_optimizer(site = 'DraftKings', sport = 'BASKETBALL', contest_type = 'CLASSIC')
dkopt <- add_players_from_df(object = dkopt, df = df)
min <- get_player_id(dkopt,'Cam Reddish') #SG/SF min2 <-get_player_id(dkopt,'Willy Hernangomez') #PF/C min3 <-get_player_id(dkopt,'Delon Wright') #PG min4 <-get_player_id(dkopt,'Saddiq Bey') #SF/SG min5 <-get_player_id(dkopt,'LeBron James') #SF/PF
dkopt<-dkopt%>% lock_players_by_id(min)%>% lock_players_by_id(min2)%>% set_player_min_exp(id= min3, exp= .2)%>% set_player_min_exp(id= min4, exp= .4)%>% set_player_min_exp(id= min5, exp= .4)
lineups2 <- build_lineups(opt, num_lineups = 150) summary(lineups2)`