Spaces:
Sleeping
Sleeping
MilesCranmer
commited on
Commit
•
82bd48e
1
Parent(s):
c20f5e3
Move operator docs to separate file
Browse files- README.md +0 -50
- docs/operators.md +70 -0
- pydoc-markdown.yml +12 -6
README.md
CHANGED
@@ -130,56 +130,6 @@ equations = pysr.pysr(X, y, weights=weights, procs=10)
|
|
130 |
```
|
131 |
|
132 |
|
133 |
-
|
134 |
-
# Operators
|
135 |
-
|
136 |
-
All Base julia operators that take 1 or 2 float32 as input,
|
137 |
-
and output a float32 as output, are available. A selection
|
138 |
-
of these and other valid operators are stated below. You can also
|
139 |
-
define your own in `operators.jl`, and pass the function
|
140 |
-
name as a string.
|
141 |
-
|
142 |
-
Your operator should work with the entire real line (you can use
|
143 |
-
abs(x) - see `logm`); otherwise
|
144 |
-
the search code will be slowed down with domain errors.
|
145 |
-
|
146 |
-
**Binary**
|
147 |
-
|
148 |
-
`plus`, `mult`, `pow`, `div`, `greater`, `mod`, `beta`, `logical_or`,
|
149 |
-
`logical_and`
|
150 |
-
|
151 |
-
**Unary**
|
152 |
-
|
153 |
-
`neg`,
|
154 |
-
`exp`,
|
155 |
-
`abs`,
|
156 |
-
`logm` (=log(abs(x) + 1e-8)),
|
157 |
-
`logm10` (=log10(abs(x) + 1e-8)),
|
158 |
-
`logm2` (=log2(abs(x) + 1e-8)),
|
159 |
-
`sqrtm` (=sqrt(abs(x)))
|
160 |
-
`log1p`,
|
161 |
-
`sin`,
|
162 |
-
`cos`,
|
163 |
-
`tan`,
|
164 |
-
`sinh`,
|
165 |
-
`cosh`,
|
166 |
-
`tanh`,
|
167 |
-
`asin`,
|
168 |
-
`acos`,
|
169 |
-
`atan`,
|
170 |
-
`asinh`,
|
171 |
-
`acosh`,
|
172 |
-
`atanh`,
|
173 |
-
`erf`,
|
174 |
-
`erfc`,
|
175 |
-
`gamma`,
|
176 |
-
`relu`,
|
177 |
-
`round`,
|
178 |
-
`floor`,
|
179 |
-
`ceil`,
|
180 |
-
`round`,
|
181 |
-
`sign`.
|
182 |
-
|
183 |
# Full API
|
184 |
|
185 |
What follows is the API reference for running the numpy interface.
|
|
|
130 |
```
|
131 |
|
132 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
133 |
# Full API
|
134 |
|
135 |
What follows is the API reference for running the numpy interface.
|
docs/operators.md
CHANGED
@@ -0,0 +1,70 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Operators
|
2 |
+
|
3 |
+
## Pre-defined
|
4 |
+
|
5 |
+
All Base julia operators that take 1 or 2 float32 as input,
|
6 |
+
and output a float32 as output, are available. A selection
|
7 |
+
of these and other valid operators are stated below.
|
8 |
+
|
9 |
+
**Binary**
|
10 |
+
|
11 |
+
`plus`, `mult`, `pow`, `div`, `greater`, `mod`, `beta`, `logical_or`,
|
12 |
+
`logical_and`
|
13 |
+
|
14 |
+
**Unary**
|
15 |
+
|
16 |
+
`neg`,
|
17 |
+
`exp`,
|
18 |
+
`abs`,
|
19 |
+
`logm` (=log(abs(x) + 1e-8)),
|
20 |
+
`logm10` (=log10(abs(x) + 1e-8)),
|
21 |
+
`logm2` (=log2(abs(x) + 1e-8)),
|
22 |
+
`sqrtm` (=sqrt(abs(x)))
|
23 |
+
`log1p`,
|
24 |
+
`sin`,
|
25 |
+
`cos`,
|
26 |
+
`tan`,
|
27 |
+
`sinh`,
|
28 |
+
`cosh`,
|
29 |
+
`tanh`,
|
30 |
+
`asin`,
|
31 |
+
`acos`,
|
32 |
+
`atan`,
|
33 |
+
`asinh`,
|
34 |
+
`acosh`,
|
35 |
+
`atanh`,
|
36 |
+
`erf`,
|
37 |
+
`erfc`,
|
38 |
+
`gamma`,
|
39 |
+
`relu`,
|
40 |
+
`round`,
|
41 |
+
`floor`,
|
42 |
+
`ceil`,
|
43 |
+
`round`,
|
44 |
+
`sign`.
|
45 |
+
|
46 |
+
## Custom
|
47 |
+
|
48 |
+
Instead of passing a predefined operator as a string,
|
49 |
+
you can define with by passing it to the `pysr` function, with, e.g.,
|
50 |
+
|
51 |
+
```python
|
52 |
+
pysr(
|
53 |
+
...,
|
54 |
+
unary_operators=["myfunction(x) = x^2"],
|
55 |
+
binary_operators=["myotherfunction(x, y) = x^2*y"]
|
56 |
+
)
|
57 |
+
```
|
58 |
+
|
59 |
+
|
60 |
+
You can also define your own in `julia/operators.jl`,
|
61 |
+
and pass the function name as a string. This is suitable
|
62 |
+
for more complex functions. Make sure that it works with
|
63 |
+
`Float32` as a datatype. That means you need to write `1.5f3`
|
64 |
+
instead of `1.5e3`, if you write any constant numbers.
|
65 |
+
|
66 |
+
Your operator should work with the entire real line (you can use
|
67 |
+
abs(x) - see `logm`); otherwise
|
68 |
+
the search code will be slowed down with domain errors.
|
69 |
+
|
70 |
+
|
pydoc-markdown.yml
CHANGED
@@ -1,19 +1,25 @@
|
|
1 |
loaders:
|
2 |
- type: python
|
|
|
3 |
processors:
|
4 |
- type: filter
|
5 |
- type: smart
|
6 |
- type: crossref
|
7 |
renderer:
|
8 |
-
type:
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
pages:
|
10 |
- title: Home
|
11 |
name: index
|
12 |
source: README.md
|
|
|
|
|
|
|
13 |
- title: API Documentation
|
14 |
contents:
|
15 |
-
-
|
16 |
-
mkdocs_config:
|
17 |
-
mkdocs_config:
|
18 |
-
site_name: PySR
|
19 |
-
theme: readthedocs
|
|
|
1 |
loaders:
|
2 |
- type: python
|
3 |
+
#search_path: [pysr]
|
4 |
processors:
|
5 |
- type: filter
|
6 |
- type: smart
|
7 |
- type: crossref
|
8 |
renderer:
|
9 |
+
type: hugo
|
10 |
+
config:
|
11 |
+
title: My Project
|
12 |
+
theme: {clone_url: "https://github.com/alex-shpak/hugo-book.git"}
|
13 |
+
# The "book" theme only renders pages in "content/docs" into the nav.
|
14 |
+
content_directory: content/docs
|
15 |
+
default_preamble: {menu: main}
|
16 |
pages:
|
17 |
- title: Home
|
18 |
name: index
|
19 |
source: README.md
|
20 |
+
- title: Operators
|
21 |
+
name: operators
|
22 |
+
source: docs/operators.md
|
23 |
- title: API Documentation
|
24 |
contents:
|
25 |
+
- pysr.sr.pysr
|
|
|
|
|
|
|
|