Spaces:
Sleeping
Sleeping
File size: 1,415 Bytes
82bd48e ba42fd1 82bd48e c835184 82bd48e ba42fd1 82bd48e ba42fd1 09f006f 82bd48e ba42fd1 82bd48e |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
# Operators
## Pre-defined
All Base julia operators that take 1 or 2 float32 as input,
and output a float32 as output, are available. A selection
of these and other valid operators are stated below.
**Binary**
`plus`, `sub`, `mult`, `pow`, `div`, `greater`, `mod`, `logical_or`,
`logical_and`
**Unary**
`neg`,
`square`,
`cube`,
`exp`,
`abs`,
`log_abs` (=log(abs(x) + 1e-8)),
`log10_abs`,
`log2_abs`,
`log1p_abs` (=log(abs(x) + 1)),
`sqrt_abs` (=sqrt(abs(x)))
`sin`,
`cos`,
`tan`,
`sinh`,
`cosh`,
`tanh`,
`atan`,
`asinh`,
`acosh_abs`,
`atanh_clip` (=atanh((x+1)%2 - 1)),
`erf`,
`erfc`,
`gamma`,
`relu`,
`round`,
`floor`,
`ceil`,
`round`,
`sign`.
## Custom
Instead of passing a predefined operator as a string,
you can define with by passing it to the `pysr` function, with, e.g.,
```python
pysr(
...,
unary_operators=["myfunction(x) = x^2"],
binary_operators=["myotherfunction(x, y) = x^2*y"]
)
```
You can also define your own in `julia/operators.jl`,
and pass the function name as a string. This is suitable
for more complex functions. Make sure that it works with
`Float32` as a datatype. That means you need to write `1.5f3`
instead of `1.5e3`, if you write any constant numbers.
Your operator should work with the entire real line (you can use
abs(x) for operators requiring positive input - see `log_abs`); otherwise
the search code will experience domain errors.
|