Skip to content

Commit

Permalink
Merge branch 'master' into store-options
Browse files Browse the repository at this point in the history
  • Loading branch information
MilesCranmer authored Dec 14, 2023
2 parents 208307d + 6ff4b77 commit f21e3d6
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
6 changes: 4 additions & 2 deletions docs/operators.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ A selection of these and other valid operators are stated below.
- `*`
- `/`
- `^`
- `max`
- `min`
- `mod`
- `cond`
- Equal to `(x, y) -> x > 0 ? y : 0`
- `greater`
Expand All @@ -22,7 +25,6 @@ A selection of these and other valid operators are stated below.
- Equal to `(x, y) -> (x > 0 || y > 0) ? 1 : 0`
- `logical_and`
- Equal to `(x, y) -> (x > 0 && y > 0) ? 1 : 0`
- `mod`

**Unary**

Expand Down Expand Up @@ -60,7 +62,7 @@ A selection of these and other valid operators are stated below.
## Custom

Instead of passing a predefined operator as a string,
you can define with by passing it to the `pysr` function, with, e.g.,
you can just define a custom function as Julia code. For example:

```python
PySRRegressor(
Expand Down
7 changes: 5 additions & 2 deletions pysr/export_sympy.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,13 @@
"ceil": sympy.ceiling,
"sign": sympy.sign,
"gamma": sympy.gamma,
"round": lambda x: sympy.ceiling(x - 0.5),
"max": lambda x, y: sympy.Piecewise((y, x < y), (x, True)),
"min": lambda x, y: sympy.Piecewise((x, x < y), (y, True)),
"round": lambda x: sympy.ceiling(x - 0.5),
"cond": lambda x, y: sympy.Heaviside(x, H0=0) * y,
"cond": lambda x, y: sympy.Piecewise((y, x > 0), (0.0, True)),
"logical_or": lambda x, y: sympy.Piecewise((1.0, (x > 0) | (y > 0)), (0.0, True)),
"logical_and": lambda x, y: sympy.Piecewise((1.0, (x > 0) & (y > 0)), (0.0, True)),
"relu": lambda x: sympy.Piecewise((0.0, x < 0), (x, True)),
}


Expand Down
2 changes: 1 addition & 1 deletion pysr/version.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
__version__ = "0.16.4"
__version__ = "0.16.5"
__symbolic_regression_jl_version__ = "0.22.5"

0 comments on commit f21e3d6

Please sign in to comment.