James McCool commited on
Commit
8338949
·
1 Parent(s): 65506a6

Update app.py to adjust array indexing in frequency calculation functions and stack multiplier logic for Draftkings and Fanduel.

Browse files
Files changed (1) hide show
  1. app.py +6 -6
app.py CHANGED
@@ -234,14 +234,14 @@ def convert_df(array):
234
 
235
  @st.cache_data
236
  def calculate_DK_value_frequencies(np_array):
237
- unique, counts = np.unique(np_array[:, :9], return_counts=True)
238
  frequencies = counts / len(np_array) # Normalize by the number of rows
239
  combined_array = np.column_stack((unique, frequencies))
240
  return combined_array
241
 
242
  @st.cache_data
243
  def calculate_FD_value_frequencies(np_array):
244
- unique, counts = np.unique(np_array[:, :8], return_counts=True)
245
  frequencies = counts / len(np_array) # Normalize by the number of rows
246
  combined_array = np.column_stack((unique, frequencies))
247
  return combined_array
@@ -263,13 +263,13 @@ def sim_contest(Sim_size, seed_frame, maps_dict, Contest_Size, teams_playing_cou
263
  if site == 'Draftkings':
264
  # Calculate stack multipliers first
265
  stack_multiplier = np.ones(fp_random.shape[0]) # Start with no bonus
266
- stack_multiplier += np.minimum(0.10, np.where(fp_random[:, 12] == 4, 0.025 * (teams_playing_count - 8), 0))
267
- stack_multiplier += np.minimum(0.15, np.where(fp_random[:, 12] >= 5, 0.025 * (teams_playing_count - 12), 0))
268
  elif site == 'Fanduel':
269
  # Calculate stack multipliers first
270
  stack_multiplier = np.ones(fp_random.shape[0]) # Start with no bonus
271
- stack_multiplier += np.minimum(0.10, np.where(fp_random[:, 11] == 4, 0.025 * (teams_playing_count - 8), 0))
272
- stack_multiplier += np.minimum(0.15, np.where(fp_random[:, 11] >= 5, 0.025 * (teams_playing_count - 12), 0))
273
 
274
  # Apply multipliers to both loc and scale in the normal distribution
275
  base_projections = np.sum(np.random.normal(
 
234
 
235
  @st.cache_data
236
  def calculate_DK_value_frequencies(np_array):
237
+ unique, counts = np.unique(np_array[:, :10], return_counts=True)
238
  frequencies = counts / len(np_array) # Normalize by the number of rows
239
  combined_array = np.column_stack((unique, frequencies))
240
  return combined_array
241
 
242
  @st.cache_data
243
  def calculate_FD_value_frequencies(np_array):
244
+ unique, counts = np.unique(np_array[:, :9], return_counts=True)
245
  frequencies = counts / len(np_array) # Normalize by the number of rows
246
  combined_array = np.column_stack((unique, frequencies))
247
  return combined_array
 
263
  if site == 'Draftkings':
264
  # Calculate stack multipliers first
265
  stack_multiplier = np.ones(fp_random.shape[0]) # Start with no bonus
266
+ stack_multiplier += np.minimum(0.10, np.where(fp_random[:, 13] == 4, 0.025 * (teams_playing_count - 8), 0))
267
+ stack_multiplier += np.minimum(0.15, np.where(fp_random[:, 13] >= 5, 0.025 * (teams_playing_count - 12), 0))
268
  elif site == 'Fanduel':
269
  # Calculate stack multipliers first
270
  stack_multiplier = np.ones(fp_random.shape[0]) # Start with no bonus
271
+ stack_multiplier += np.minimum(0.10, np.where(fp_random[:, 12] == 4, 0.025 * (teams_playing_count - 8), 0))
272
+ stack_multiplier += np.minimum(0.15, np.where(fp_random[:, 12] >= 5, 0.025 * (teams_playing_count - 12), 0))
273
 
274
  # Apply multipliers to both loc and scale in the normal distribution
275
  base_projections = np.sum(np.random.normal(