FelixPhilip commited on
Commit
b180b70
·
1 Parent(s): a89ed26
Files changed (1) hide show
  1. Oracle/deepfundingoracle.py +10 -8
Oracle/deepfundingoracle.py CHANGED
@@ -339,6 +339,9 @@ def visualize_feature_distributions(df):
339
  Visualizes feature distributions and correlations.
340
  """
341
  print("[INFO] Visualizing feature distributions and correlations...")
 
 
 
342
  numeric_cols = df.select_dtypes(include=[np.number]).columns
343
 
344
  # Plot feature distributions
@@ -362,14 +365,13 @@ def normalize_and_clip_weights(df,group_col="parent",weight_col ="final_weight")
362
  df[weight_col] = df[weight_col].clip(lower=0)
363
 
364
  #Normalize weights within each group
365
- def normalize_group(x):
366
- total = x.sum()
367
- if total>0:
368
- return x/total
369
- else:
370
- return np.ones_like(x)/ len(x)
371
- df[weight_col] = df.groupby(group_col)[weight_col].transform(normalize_group)
372
- return df
373
 
374
 
375
  def normalize_funding(df):
 
339
  Visualizes feature distributions and correlations.
340
  """
341
  print("[INFO] Visualizing feature distributions and correlations...")
342
+ if not plt or not sns:
343
+ print("[ERROR] Matplotlib or Seaborn not available for visualization.")
344
+ return
345
  numeric_cols = df.select_dtypes(include=[np.number]).columns
346
 
347
  # Plot feature distributions
 
365
  df[weight_col] = df[weight_col].clip(lower=0)
366
 
367
  #Normalize weights within each group
368
+ def normalize_group(x):
369
+ total = x.sum()
370
+ if total>0:
371
+ return x/total
372
+ return np.ones_like(x)/ len(x)
373
+ df[weight_col] = df.groupby(group_col)[weight_col].transform(normalize_group)
374
+ return df
 
375
 
376
 
377
  def normalize_funding(df):