Spaces:
Sleeping
Sleeping
Commit
·
9b9db9e
1
Parent(s):
3f4ce91
Make file move to Eureqa directory no matter where it is called
Browse files
eureqa.py
CHANGED
|
@@ -1,6 +1,7 @@
|
|
| 1 |
import os
|
| 2 |
from argparse import ArgumentParser, ArgumentDefaultsHelpFormatter
|
| 3 |
from collections import namedtuple
|
|
|
|
| 4 |
|
| 5 |
|
| 6 |
def eureqa(threads=4, parsimony=1e-3, alpha=10,
|
|
@@ -63,15 +64,21 @@ def eureqa(threads=4, parsimony=1e-3, alpha=10,
|
|
| 63 |
print(def_datasets, file=f)
|
| 64 |
|
| 65 |
command = ' '.join([
|
|
|
|
|
|
|
| 66 |
'julia -O3',
|
| 67 |
f'--threads {threads}',
|
| 68 |
'-e',
|
| 69 |
f'\'include("eureqa.jl"); fullRun({niterations:d}, npop={npop:d}, annealing={"true" if annealing else "false"}, ncyclesperiteration={ncyclesperiteration:d}, fractionReplaced={fractionReplaced:f}f0, verbosity=round(Int32, 1e9), topn={topn:d})\''
|
|
|
|
|
|
|
| 70 |
])
|
| 71 |
import os
|
| 72 |
os.system(command)
|
| 73 |
|
| 74 |
|
|
|
|
|
|
|
| 75 |
if __name__ == "__main__":
|
| 76 |
parser = ArgumentParser(formatter_class=ArgumentDefaultsHelpFormatter)
|
| 77 |
|
|
|
|
| 1 |
import os
|
| 2 |
from argparse import ArgumentParser, ArgumentDefaultsHelpFormatter
|
| 3 |
from collections import namedtuple
|
| 4 |
+
import pathlib
|
| 5 |
|
| 6 |
|
| 7 |
def eureqa(threads=4, parsimony=1e-3, alpha=10,
|
|
|
|
| 64 |
print(def_datasets, file=f)
|
| 65 |
|
| 66 |
command = ' '.join([
|
| 67 |
+
f'cd {pathlib.Path(__file__).parent.absolute()}', #Move to filepath of code
|
| 68 |
+
'&&',
|
| 69 |
'julia -O3',
|
| 70 |
f'--threads {threads}',
|
| 71 |
'-e',
|
| 72 |
f'\'include("eureqa.jl"); fullRun({niterations:d}, npop={npop:d}, annealing={"true" if annealing else "false"}, ncyclesperiteration={ncyclesperiteration:d}, fractionReplaced={fractionReplaced:f}f0, verbosity=round(Int32, 1e9), topn={topn:d})\''
|
| 73 |
+
'&&',
|
| 74 |
+
f'cd {pathlib.Path().absolute()}',
|
| 75 |
])
|
| 76 |
import os
|
| 77 |
os.system(command)
|
| 78 |
|
| 79 |
|
| 80 |
+
|
| 81 |
+
|
| 82 |
if __name__ == "__main__":
|
| 83 |
parser = ArgumentParser(formatter_class=ArgumentDefaultsHelpFormatter)
|
| 84 |
|