Add formulae for advancement and for double plays - #39
Conversation
alefeld
left a comment
There was a problem hiding this comment.
Main thing is I think we should include hype anywhere vibes are used. Groundout/flyout formulas were determined in pre-hype seasons. Also a couple of discrepancies in use of multipliers in a couple spots.
| ) | ||
|
|
||
| # No mods or vibes here -- not sure if I need to use .multiplied at all | ||
| runner_cont = runner.multiplied("continuation", 1.0) |
There was a problem hiding this comment.
I think this does need multipliers? See hit_advance.ipynb:
df["threshold_rounded"] = 0.70 - 1.0*df["fielder_tenaciousness_scaled"] + 0.60*df['runner_continuation_scaled']
| fielder_vibes = fielder.vibes(meta.day) | ||
|
|
||
| # no mods | ||
| runner_ind = runner.multiplied("indulgence", 1.0) * (1 + 0.2 * runner_vibes) |
There was a problem hiding this comment.
according to groundout_advance.ipynb it should include mods:
df["threshold_rounded"] = 0.50 \
+ 0.35 * df["runner_indulgence_with_vibe"] \
- 0.10 * df["fielder_tenaciousness_with_vibe"] \
- 0.10 * (df["ballpark_inconvenience"] - 0.50) \
- 0.10 * (df["ballpark_elongation"] - 0.50) df[attr + "_scaled"] = df[attr] * df["batter_multiplier"]
df[attr + "_with_vibe"] = df[attr + "_scaled"] * (1 + 0.2 * df["batter_vibes"])There was a problem hiding this comment.
Also, I never got to seasons with hype... but I would guess anywhere we have vibes we should also have hype?
|
|
||
| fielder_tenac = fielder.multiplied( | ||
| "tenaciousness", get_multiplier(fielder, pitching_team, "fielder", "tenaciousness", meta, stadium) | ||
| ) * (1 + 0.2 * fielder_vibes) |
| runner_ind = runner.multiplied( | ||
| "indulgence", get_multiplier(runner, batting_team, "batter", "indulgence", meta, stadium) | ||
| ) | ||
| runner_ind = runner_ind * (1 + 0.2 * runner_vibes) |
| return 0.045 + 0.065 * runner_ind + 0.30 * runner_ind_sq - park_factor | ||
| elif advancing_from == 2: | ||
| return 0.45 + 0.35 * runner_ind - park_factor | ||
| else: |
There was a problem hiding this comment.
This error gets thrown 94% of the way through running resim.py because the 5th base leads to advancing_from == 3. We don't have a formula afaik, so maybe add a special case for the 5th base that just prints a warning for now?
Adds formulae for:
Currently completely unverified, and looking for help verifying it.
Also includes some small improvements to fix warnings and (sigh) make it nicer to use with
uv.