James McCool
commited on
Commit
·
bd3e305
1
Parent(s):
817c616
Refactor reassess_dupes function in reassess_edge.py to improve readability by restructuring the return statement, while maintaining the existing logic for salary and ownership adjustments.
Browse files- global_func/reassess_edge.py +10 -10
global_func/reassess_edge.py
CHANGED
|
@@ -45,17 +45,17 @@ def calculate_weighted_ownership_single_row(row_ownerships):
|
|
| 45 |
return weighted * 10000
|
| 46 |
|
| 47 |
def reassess_dupes(row: pd.Series, salary_max: int) -> float:
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
|
|
|
| 57 |
)
|
| 58 |
-
)
|
| 59 |
|
| 60 |
def reassess_lineup_edge(row: pd.Series, Contest_Size: int) -> float:
|
| 61 |
row['Lineup Edge'] = row['Win%'] * ((.5 - row['Finish_percentile']) * (Contest_Size / 2.5))
|
|
|
|
| 45 |
return weighted * 10000
|
| 46 |
|
| 47 |
def reassess_dupes(row: pd.Series, salary_max: int) -> float:
|
| 48 |
+
return math.ceil(
|
| 49 |
+
row['Dupes'] +
|
| 50 |
+
(
|
| 51 |
+
# Salary component: base +2 + salary_diff/200 for every $100 above threshold
|
| 52 |
+
(max(0, (row['salary'] - (salary_max - 500)) / 100) * (2 + (row['salary_diff'] / 200)) *
|
| 53 |
+
(1 if row['salary_diff'] >= 0 else -1)) +
|
| 54 |
+
|
| 55 |
+
# Ownership component: direct negative/positive effect
|
| 56 |
+
(row['own_diff'] / 10)
|
| 57 |
+
)
|
| 58 |
)
|
|
|
|
| 59 |
|
| 60 |
def reassess_lineup_edge(row: pd.Series, Contest_Size: int) -> float:
|
| 61 |
row['Lineup Edge'] = row['Win%'] * ((.5 - row['Finish_percentile']) * (Contest_Size / 2.5))
|