James McCool commited on
Commit
f978f29
·
1 Parent(s): 5dc36a5

Add debug statements in calculate_weighted_ownership function: include print statements to trace input values and intermediate calculations, aiding in the debugging process for ownership metrics.

Browse files
Files changed (1) hide show
  1. global_func/predict_dupes.py +8 -0
global_func/predict_dupes.py CHANGED
@@ -16,20 +16,28 @@ def calculate_weighted_ownership(row_ownerships):
16
  Returns:
17
  float: Calculated weighted ownership value
18
  """
 
 
 
19
  # Get the mean of all ownership values
20
  row_mean = row_ownerships.mean()
 
21
 
22
  # Calculate average of each value with the overall mean
23
  value_means = [(val + row_mean) / 2 for val in row_ownerships]
 
24
 
25
  # Take average of all those means
26
  avg_of_means = sum(value_means) / len(value_means)
 
27
 
28
  # Multiply by count of values
29
  weighted = avg_of_means * len(row_ownerships)
 
30
 
31
  # Subtract (max - min)
32
  weighted = weighted - (row_ownerships.max() - row_ownerships.min())
 
33
 
34
  return weighted
35
 
 
16
  Returns:
17
  float: Calculated weighted ownership value
18
  """
19
+ print("Input row:", row_ownerships) # Debug print
20
+ print("Type:", type(row_ownerships)) # Debug print
21
+
22
  # Get the mean of all ownership values
23
  row_mean = row_ownerships.mean()
24
+ print("Row mean:", row_mean) # Debug print
25
 
26
  # Calculate average of each value with the overall mean
27
  value_means = [(val + row_mean) / 2 for val in row_ownerships]
28
+ print("Value means:", value_means) # Debug print
29
 
30
  # Take average of all those means
31
  avg_of_means = sum(value_means) / len(value_means)
32
+ print("Average of means:", avg_of_means) # Debug print
33
 
34
  # Multiply by count of values
35
  weighted = avg_of_means * len(row_ownerships)
36
+ print("After multiplication:", weighted) # Debug print
37
 
38
  # Subtract (max - min)
39
  weighted = weighted - (row_ownerships.max() - row_ownerships.min())
40
+ print("Final weighted:", weighted) # Debug print
41
 
42
  return weighted
43