James McCool commited on
Commit
2f5846d
·
1 Parent(s): 2fa1322

Update bimodal distribution sampling in NBA ROO functions to use floor and ceiling values

Browse files
Files changed (1) hide show
  1. function_hold/NBA_functions.py +8 -4
function_hold/NBA_functions.py CHANGED
@@ -117,6 +117,8 @@ def DK_NBA_ROO_Build(projections_file, floor_var, ceiling_var, std_var, distribu
117
  salary_file = flex_file.copy()
118
 
119
  try:
 
 
120
  overall_median_gpu = np_array(overall_file['Median'])
121
  overall_std_gpu = np_array(overall_file['STD'])
122
  overall_salary_gpu = np_array(overall_file['Salary'])
@@ -154,9 +156,9 @@ def DK_NBA_ROO_Build(projections_file, floor_var, ceiling_var, std_var, distribu
154
  # Bimodal distribution - mixture of two normal distributions
155
  # First peak centered at 80% of median, second at 120% of median
156
  if np_random.random() < 0.5:
157
- result_gpu = np_random.normal(overall_median_gpu * 0.8, overall_std_gpu)
158
  else:
159
- result_gpu = np_random.normal(overall_median_gpu * 1.2, overall_std_gpu)
160
  else:
161
  raise ValueError("Invalid distribution type. Must be 'normal', 'poisson', or 'bimodal'")
162
 
@@ -340,6 +342,8 @@ def FD_NBA_ROO_Build(projections_file, floor_var, ceiling_var, std_var, distribu
340
  salary_file = flex_file.copy()
341
 
342
  try:
 
 
343
  overall_median_gpu = np_array(overall_file['Median'])
344
  overall_std_gpu = np_array(overall_file['STD'])
345
  overall_salary_gpu = np_array(overall_file['Salary'])
@@ -377,9 +381,9 @@ def FD_NBA_ROO_Build(projections_file, floor_var, ceiling_var, std_var, distribu
377
  # Bimodal distribution - mixture of two normal distributions
378
  # First peak centered at 80% of median, second at 120% of median
379
  if np_random.random() < 0.5:
380
- result_gpu = np_random.normal(overall_median_gpu * 0.8, overall_std_gpu)
381
  else:
382
- result_gpu = np_random.normal(overall_median_gpu * 1.2, overall_std_gpu)
383
  else:
384
  raise ValueError("Invalid distribution type. Must be 'normal', 'poisson', or 'bimodal'")
385
 
 
117
  salary_file = flex_file.copy()
118
 
119
  try:
120
+ overall_floor_gpu = np_array(overall_file['Floor'])
121
+ overall_ceiling_gpu = np_array(overall_file['Ceiling'])
122
  overall_median_gpu = np_array(overall_file['Median'])
123
  overall_std_gpu = np_array(overall_file['STD'])
124
  overall_salary_gpu = np_array(overall_file['Salary'])
 
156
  # Bimodal distribution - mixture of two normal distributions
157
  # First peak centered at 80% of median, second at 120% of median
158
  if np_random.random() < 0.5:
159
+ result_gpu = np_random.normal(overall_floor_gpu, overall_std_gpu)
160
  else:
161
+ result_gpu = np_random.normal(overall_ceiling_gpu, overall_std_gpu)
162
  else:
163
  raise ValueError("Invalid distribution type. Must be 'normal', 'poisson', or 'bimodal'")
164
 
 
342
  salary_file = flex_file.copy()
343
 
344
  try:
345
+ overall_floor_gpu = np_array(overall_file['Floor'])
346
+ overall_ceiling_gpu = np_array(overall_file['Ceiling'])
347
  overall_median_gpu = np_array(overall_file['Median'])
348
  overall_std_gpu = np_array(overall_file['STD'])
349
  overall_salary_gpu = np_array(overall_file['Salary'])
 
381
  # Bimodal distribution - mixture of two normal distributions
382
  # First peak centered at 80% of median, second at 120% of median
383
  if np_random.random() < 0.5:
384
+ result_gpu = np_random.normal(overall_floor_gpu, overall_std_gpu)
385
  else:
386
+ result_gpu = np_random.normal(overall_ceiling_gpu, overall_std_gpu)
387
  else:
388
  raise ValueError("Invalid distribution type. Must be 'normal', 'poisson', or 'bimodal'")
389