MilesCranmer commited on
Commit
21fb25d
1 Parent(s): 3b15555

Add more piecewise operators

Browse files
Files changed (1) hide show
  1. pysr/export_sympy.py +5 -2
pysr/export_sympy.py CHANGED
@@ -47,10 +47,13 @@ sympy_mappings = {
47
  "ceil": sympy.ceiling,
48
  "sign": sympy.sign,
49
  "gamma": sympy.gamma,
 
50
  "max": lambda x, y: sympy.Piecewise((y, x < y), (x, True)),
51
  "min": lambda x, y: sympy.Piecewise((x, x < y), (y, True)),
52
- "round": lambda x: sympy.ceiling(x - 0.5),
53
- "cond": lambda x, y: sympy.Heaviside(x, H0=0) * y,
 
 
54
  }
55
 
56
 
 
47
  "ceil": sympy.ceiling,
48
  "sign": sympy.sign,
49
  "gamma": sympy.gamma,
50
+ "round": lambda x: sympy.ceiling(x - 0.5),
51
  "max": lambda x, y: sympy.Piecewise((y, x < y), (x, True)),
52
  "min": lambda x, y: sympy.Piecewise((x, x < y), (y, True)),
53
+ "cond": lambda x, y: sympy.Piecewise((y, x > 0), (0.0, True)),
54
+ "logical_or": lambda x, y: sympy.Piecewise((1.0, (x > 0) | (y > 0)), (0.0, True)),
55
+ "logical_and": lambda x, y: sympy.Piecewise((1.0, (x > 0) & (y > 0)), (0.0, True)),
56
+ "relu": lambda x: sympy.Piecewise((0.0, x < 0), (x, True)),
57
  }
58
 
59