James McCool
commited on
Commit
·
fe4cd6d
1
Parent(s):
24c4247
Enhance reassess_dupes function in reassess_edge.py by implementing a threshold-based adjustment mechanism for dupes, improving accuracy in ownership calculations while removing redundant debug statements for cleaner code.
Browse files- global_func/reassess_edge.py +21 -18
global_func/reassess_edge.py
CHANGED
|
@@ -45,29 +45,32 @@ 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 |
salary = int(row['salary'])
|
| 50 |
salary_diff = int(row['salary_diff'])
|
| 51 |
own_diff = float(row['own_diff'])
|
| 52 |
dupes = int(row['Dupes'])
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
(own_diff / 10)
|
| 69 |
)
|
| 70 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 71 |
|
| 72 |
def reassess_lineup_edge(row: pd.Series, Contest_Size: int) -> float:
|
| 73 |
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 |
+
# Convert to signed integers to avoid uint16 wrap-around
|
| 49 |
salary = int(row['salary'])
|
| 50 |
salary_diff = int(row['salary_diff'])
|
| 51 |
own_diff = float(row['own_diff'])
|
| 52 |
dupes = int(row['Dupes'])
|
| 53 |
+
|
| 54 |
+
# Calculate distance from threshold
|
| 55 |
+
threshold = salary_max - 500
|
| 56 |
+
distance_from_threshold = salary - threshold
|
| 57 |
+
|
| 58 |
+
# Apply dramatic reduction when below threshold
|
| 59 |
+
if distance_from_threshold < 0:
|
| 60 |
+
# For every 100 under threshold, divide dupes by 2
|
| 61 |
+
reduction_factor = 2 ** (abs(distance_from_threshold) / 100)
|
| 62 |
+
adjusted_dupes = dupes / reduction_factor
|
| 63 |
+
else:
|
| 64 |
+
# Above threshold: use original formula
|
| 65 |
+
adjusted_dupes = dupes + (
|
| 66 |
+
(distance_from_threshold / 100) * (2 + (salary_diff / 200)) *
|
| 67 |
+
(1 if salary_diff >= 0 else -1)
|
|
|
|
| 68 |
)
|
| 69 |
+
|
| 70 |
+
# Add ownership component
|
| 71 |
+
final_dupes = adjusted_dupes + (own_diff / 10)
|
| 72 |
+
|
| 73 |
+
return math.ceil(final_dupes)
|
| 74 |
|
| 75 |
def reassess_lineup_edge(row: pd.Series, Contest_Size: int) -> float:
|
| 76 |
row['Lineup Edge'] = row['Win%'] * ((.5 - row['Finish_percentile']) * (Contest_Size / 2.5))
|