MilesCranmer commited on
Commit
43cceb0
1 Parent(s): cf8bf07

Copy getting started info to separate file

Browse files
Files changed (2) hide show
  1. docs/start.md +59 -0
  2. pydoc-markdown.yml +9 -6
docs/start.md ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Getting Started
2
+
3
+ ## Installation
4
+ PySR uses both Julia and Python, so you need to have both installed.
5
+
6
+ Install Julia - see [downloads](https://julialang.org/downloads/), and
7
+ then instructions for [mac](https://julialang.org/downloads/platform/#macos)
8
+ and [linux](https://julialang.org/downloads/platform/#linux_and_freebsd).
9
+ (Don't use the `conda-forge` version; it doesn't seem to work properly.)
10
+ Then, at the command line,
11
+ install the `Optim` and `SpecialFunctions` packages via:
12
+
13
+ ```bash
14
+ julia -e 'import Pkg; Pkg.add("Optim"); Pkg.add("SpecialFunctions")'
15
+ ```
16
+
17
+ For python, you need to have Python 3, numpy, sympy, and pandas installed.
18
+
19
+ You can install this package from PyPI with:
20
+
21
+ ```bash
22
+ pip install pysr
23
+ ```
24
+
25
+ ## Quickstart
26
+
27
+ ```python
28
+ import numpy as np
29
+ from pysr import pysr
30
+
31
+ # Dataset
32
+ X = 2*np.random.randn(100, 5)
33
+ y = 2*np.cos(X[:, 3]) + X[:, 0]**2 - 2
34
+
35
+ # Learn equations
36
+ equations = pysr(X, y, niterations=5,
37
+ binary_operators=["plus", "mult"],
38
+ unary_operators=["cos", "exp", "sin"])
39
+
40
+ ...
41
+
42
+ print(equations)
43
+ ```
44
+
45
+ which gives:
46
+
47
+ ```
48
+ Complexity MSE Equation
49
+ 0 5 1.947431 plus(-1.7420927, mult(x0, x0))
50
+ 1 8 0.486858 plus(-1.8710494, plus(cos(x3), mult(x0, x0)))
51
+ 2 11 0.000000 plus(plus(mult(x0, x0), cos(x3)), plus(-2.0, cos(x3)))
52
+ ```
53
+
54
+ The newest version of PySR also returns three additional columns:
55
+
56
+ - `score` - a metric akin to Occam's razor; you should use this to help select the "true" equation.
57
+ - `sympy_format` - sympy equation.
58
+ - `lambda_format` - a lambda function for that equation, that you can pass values through.
59
+
pydoc-markdown.yml CHANGED
@@ -36,12 +36,15 @@ renderer:
36
  name: index
37
  source: README.md
38
  directory: '..'
39
- - title: API Documentation
40
- contents:
41
- - pysr.sr.pysr
42
- - title: Operators
43
- name: operators
44
- source: docs/operators.md
45
  - title: Options
46
  name: options
47
  source: docs/options.md
 
 
 
 
 
 
 
36
  name: index
37
  source: README.md
38
  directory: '..'
39
+ - title: Getting started
40
+ name: getting-started
41
+ source: docs/start.md
 
 
 
42
  - title: Options
43
  name: options
44
  source: docs/options.md
45
+ - title: Operators
46
+ name: operators
47
+ source: docs/operators.md
48
+ - title: API Documentation
49
+ contents:
50
+ - pysr.sr.pysr