chrisjay commited on
Commit
b9ceb4f
1 Parent(s): 6843958

fix to nan issue in mean and std reward

Browse files
Files changed (2) hide show
  1. app.py +5 -0
  2. utils.py +4 -4
app.py CHANGED
@@ -48,6 +48,8 @@ def get_data(rl_env):
48
  row["Model"] = model_id
49
  accuracy = parse_metrics_accuracy(meta)
50
  mean_reward, std_reward = parse_rewards(accuracy)
 
 
51
  row["Results"] = mean_reward - std_reward
52
  row["Mean Reward"] = mean_reward
53
  row["Std Reward"] = std_reward
@@ -113,6 +115,9 @@ def update_data(rl_env):
113
  row["Model"] = model_id
114
  accuracy = parse_metrics_accuracy(meta)
115
  mean_reward, std_reward = parse_rewards(accuracy)
 
 
 
116
  row["Results"] = mean_reward - std_reward
117
  row["Mean Reward"] = mean_reward
118
  row["Std Reward"] = std_reward
 
48
  row["Model"] = model_id
49
  accuracy = parse_metrics_accuracy(meta)
50
  mean_reward, std_reward = parse_rewards(accuracy)
51
+ mean_reward = mean_reward if not pd.isna(mean_reward) else 0
52
+ std_reward = std_reward if not pd.isna(std_reward) else 0
53
  row["Results"] = mean_reward - std_reward
54
  row["Mean Reward"] = mean_reward
55
  row["Std Reward"] = std_reward
 
115
  row["Model"] = model_id
116
  accuracy = parse_metrics_accuracy(meta)
117
  mean_reward, std_reward = parse_rewards(accuracy)
118
+ mean_reward = mean_reward if not pd.isna(mean_reward) else 0
119
+ std_reward = std_reward if not pd.isna(std_reward) else 0
120
+
121
  row["Results"] = mean_reward - std_reward
122
  row["Mean Reward"] = mean_reward
123
  row["Std Reward"] = std_reward
utils.py CHANGED
@@ -53,11 +53,11 @@ def parse_rewards(accuracy):
53
  mean_reward = float(parsed[0])
54
  std_reward = float(parsed[1])
55
  else:
56
- mean_reward = default_std
57
- std_reward = default_reward
58
 
59
  else:
60
- mean_reward = default_std
61
- std_reward = default_reward
62
  return mean_reward, std_reward
63
 
 
53
  mean_reward = float(parsed[0])
54
  std_reward = float(parsed[1])
55
  else:
56
+ mean_reward = float(default_std)
57
+ std_reward = float(default_reward)
58
 
59
  else:
60
+ mean_reward = float(default_std)
61
+ std_reward = float(default_reward)
62
  return mean_reward, std_reward
63