MilesCranmer commited on
Commit
c8d959a
1 Parent(s): fd06a40

Add benchmark file

Browse files
Files changed (1) hide show
  1. test/benchmark.sh +13 -0
test/benchmark.sh ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ python setup.py install > /dev/null && python -c '
2
+ import pkg_resources
3
+ version = pkg_resources.get_distribution("pysr").version
4
+ version = [int(elem) for elem in version.split(".")]
5
+ import numpy as np
6
+ from pysr import pysr
7
+ X=np.random.randn(100, 2)*5
8
+ y=2*np.sin((X[:, 0]+X[:, 1]))*np.exp(X[:, 1]/3)
9
+ if version[1] >= 3 and version[2] > 2:
10
+ eq = pysr(X, y, binary_operators=["plus", "mult", "div", "pow"], unary_operators=["neg", "sin"], niterations=20, procs=2, parsimony=1e-10)
11
+ else:
12
+ eq = pysr(X, y, binary_operators=["plus", "mult", "div", "pow"], unary_operators=["neg", "sin"], niterations=20, threads=2, parsimony=1e-10)
13
+ ' 2>&1 | grep 'Cycles per second' | tail -n 1 | vims '%s/ //g' -l 'df:'