gaurv007 commited on
Commit
8b456b8
·
verified ·
1 Parent(s): 82fe9b4

Upload alpha_factory/deterministic/expression_mutator.py

Browse files
alpha_factory/deterministic/expression_mutator.py CHANGED
@@ -116,16 +116,13 @@ def mutate_vol_scale(expression: str) -> list[dict]:
116
 
117
  def mutate_sign_flip(expression: str) -> list[dict]:
118
  """Flip the sign of the entire expression (test opposite direction)."""
119
- # Remove existing negation or add one
120
- inner = expression
121
-
122
  # Extract inner from ts_decay_linear wrapper
123
  match = re.match(r"ts_decay_linear\((.+),\s*(\d+)\)$", expression)
124
  if match:
125
  inner_expr = match.group(1).strip()
126
  decay = match.group(2)
127
 
128
- if inner_expr.startswith("-(") and inner_expr.endswith(")"):
129
  # Remove negation
130
  flipped = inner_expr[2:-1]
131
  else:
 
116
 
117
  def mutate_sign_flip(expression: str) -> list[dict]:
118
  """Flip the sign of the entire expression (test opposite direction)."""
 
 
 
119
  # Extract inner from ts_decay_linear wrapper
120
  match = re.match(r"ts_decay_linear\((.+),\s*(\d+)\)$", expression)
121
  if match:
122
  inner_expr = match.group(1).strip()
123
  decay = match.group(2)
124
 
125
+ if inner_expr.startswith("-(" ) and inner_expr.endswith(")"):
126
  # Remove negation
127
  flipped = inner_expr[2:-1]
128
  else: