Skip to content

Commit ef76f1a

Browse files
committed
fix: update after normalization
1 parent 4ee98bb commit ef76f1a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

dynamicalgorithmselection/agents/agent_utils.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -135,12 +135,12 @@ def __init__(self, max_steps, clip_reward=10.0):
135135

136136
def normalize(self, reward, step_idx, update=True):
137137
idx = min(step_idx, self.max_steps - 1)
138-
if update:
139-
self.stats[idx].update(np.array([reward]))
140138

141139
mean = self.stats[idx].mean
142140
std = np.sqrt(self.stats[idx].var) + 1e-8
143-
144141
normalized_reward = (reward - mean) / std
145142

143+
if update:
144+
self.stats[idx].update(np.array([reward]))
145+
146146
return np.clip(normalized_reward, -self.clip, self.clip)

0 commit comments

Comments
 (0)