Open jt026 opened 2 years ago
Here's what I use.
class NormalVariateFantasyPointsStrategy(BaseFantasyPointsStrategy):
def get_player_fantasy_points(self, player: Player) -> float:
# std deviation stored in max_deviation scaled by 100
if player.max_deviation is not None:
return random.gauss(mu=player.fppg, sigma=player.max_deviation * 100.0)
return 0
How do you add this to the code? I apologize but I am still learning python.
for your code i get File "/home/joe/.local/lib/python3.7/site-packages/pydfs_lineup_optimizer/lineup_optimizer.py", line 433, in optimize constraint.apply_for_iteration(solver, previous_lineup) File "/home/joe/.local/lib/python3.7/site-packages/pydfs_lineup_optimizer/rules.py", line 65, in apply_for_iteration fantasy_points = get_points(player) TypeError: get_player_fantasy_points() missing 1 required positional argument: 'player'
I have added your class into the necessary files
On Tue, Oct 4, 2022 at 11:59 PM Cmilne24 @.***> wrote:
How do you add this to the code? I apologize but I am still learning python.
— Reply to this email directly, view it on GitHub https://github.com/DimaKudosh/pydfs-lineup-optimizer/issues/367#issuecomment-1267904304, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANBWO7QH2TNIMOUU6X77QKDWBT4IPANCNFSM5XMHXYOA . You are receiving this because you are subscribed to this thread.Message ID: @.***>
--
ĵÖȘΈΦΗ
Hi @Denwen12 , Did you ever get this TypeError exception resolved? I am now running into the same issue. I believe the issue happens when the randomness parameter is set to False. I'm not sure if having set to True would override the NormalVariate class and set it to the RandomFantasyPointStrategy instead. Your thoughts?
I did get it working
What was your solution?
On Mar 13, 2023, at 21:46, Denwen12 @.***> wrote:
I did get it working
— Reply to this email directly, view it on GitHubhttps://github.com/DimaKudosh/pydfs-lineup-optimizer/issues/367#issuecomment-1467306866, or unsubscribehttps://github.com/notifications/unsubscribe-auth/A3P3P7IXQLVIURFZHTKW6J3W37SYRANCNFSM5XMHXYOA. You are receiving this because you commented.Message ID: @.***>
You can try it like this class NormalVariateFantasyPointsStrategy(BaseFantasyPointsStrategy): def get_player_fantasy_points(self, player: Player) -> float: if player.min_deviation is not None: return player.fppg else: mu = player.fppg sigma = 15 return (random.gauss(mu, sigma))
It's not indentation right but I'm sure you can figure it out if not provide your email
Use it like this
You can change the sigma number to whatever you want I guess
optimizer.set_fantasy_points_strategy(NormalVariateFantasyPointsStrategy())
hi, tried searching for similar topic but couldn't find one. I am wondering if its possible to use normal distribution for the randomness when doing each line up instead of simple randomness? If anyone has worked out how to do this I would be happy to pay for it to be written into my code. Thanks