MilesCranmer commited on
Commit
e8639b3
1 Parent(s): a8ee367

Fix endless waiting for process

Browse files
Files changed (2) hide show
  1. TODO.md +3 -3
  2. pysr/sr.py +4 -5
TODO.md CHANGED
@@ -53,15 +53,16 @@
53
  - [x] Allow user to pass names for variables - use these when printing
54
  - [x] Check for domain errors in an equation quickly before actually running the entire array over it. (We do this now recursively - every single equation is checked for nans/infs when being computed.)
55
  - [x] read the docs page
 
 
 
56
  - [ ] Sort these todo lists by priority
57
 
58
  ## Feature ideas
59
 
60
- - [ ] Create backup csv file so always something to copy from for `PySR`. Also use random hall of fame file by default. Call function to read from csv after running, so dont need to run again. Dump scores alongside MSE to .csv (and return with Pandas).
61
  - [ ] Do printing from Python side. Then we can do simplification and pretty-printing.
62
  - [ ] Cross-validation
63
  - [ ] Sympy printing
64
- - [ ] Better cleanup of zombie processes after <ctl-c>
65
  - [ ] Hierarchical model, so can re-use functional forms. Output of one equation goes into second equation?
66
  - [ ] Add function to plot equations
67
  - [ ] Refresh screen rather than dumping to stdout?
@@ -69,7 +70,6 @@
69
  - [ ] Additional degree operators?
70
  - [ ] Multi targets (vector ops). Idea 1: Node struct contains argument for which registers it is applied to. Then, can work with multiple components simultaneously. Though this may be tricky to get right. Idea 2: each op is defined by input/output space. Some operators are flexible, and the spaces should be adjusted automatically. Otherwise, only consider ops that make a tree possible. But will need additional ops here to get it to work. Idea 3: define each equation in 2 parts: one part that is shared between all outputs, and one that is different between all outputs. Maybe this could be an array of nodes corresponding to each output. And those nodes would define their functions.
71
  - [ ] Tree crossover? I.e., can take as input a part of the same equation, so long as it is the same level or below?
72
- - [ ] Consider printing output sorted by score, not by complexity.
73
  - [ ] Create flexible way of providing "simplification recipes." I.e., plus(plus(T, C), C) => plus(T, +(C, C)). The user could pass these.
74
  - [ ] Consider allowing multi-threading turned off, for faster testing (cache issue on travis). Or could simply fix the caching issue there.
75
  - [ ] Consider returning only the equation of interest; rather than all equations.
 
53
  - [x] Allow user to pass names for variables - use these when printing
54
  - [x] Check for domain errors in an equation quickly before actually running the entire array over it. (We do this now recursively - every single equation is checked for nans/infs when being computed.)
55
  - [x] read the docs page
56
+ - [x] Create backup csv file so always something to copy from for `PySR`. Also use random hall of fame file by default. Call function to read from csv after running, so dont need to run again. Dump scores alongside MSE to .csv (and return with Pandas).
57
+ - [x] Better cleanup of zombie processes after <ctl-c>
58
+ - [x] Consider printing output sorted by score, not by complexity.
59
  - [ ] Sort these todo lists by priority
60
 
61
  ## Feature ideas
62
 
 
63
  - [ ] Do printing from Python side. Then we can do simplification and pretty-printing.
64
  - [ ] Cross-validation
65
  - [ ] Sympy printing
 
66
  - [ ] Hierarchical model, so can re-use functional forms. Output of one equation goes into second equation?
67
  - [ ] Add function to plot equations
68
  - [ ] Refresh screen rather than dumping to stdout?
 
70
  - [ ] Additional degree operators?
71
  - [ ] Multi targets (vector ops). Idea 1: Node struct contains argument for which registers it is applied to. Then, can work with multiple components simultaneously. Though this may be tricky to get right. Idea 2: each op is defined by input/output space. Some operators are flexible, and the spaces should be adjusted automatically. Otherwise, only consider ops that make a tree possible. But will need additional ops here to get it to work. Idea 3: define each equation in 2 parts: one part that is shared between all outputs, and one that is different between all outputs. Maybe this could be an array of nodes corresponding to each output. And those nodes would define their functions.
72
  - [ ] Tree crossover? I.e., can take as input a part of the same equation, so long as it is the same level or below?
 
73
  - [ ] Create flexible way of providing "simplification recipes." I.e., plus(plus(T, C), C) => plus(T, +(C, C)). The user could pass these.
74
  - [ ] Consider allowing multi-threading turned off, for faster testing (cache issue on travis). Or could simply fix the caching issue there.
75
  - [ ] Consider returning only the equation of interest; rather than all equations.
pysr/sr.py CHANGED
@@ -322,11 +322,10 @@ const varMap = {'["' + '", "'.join(variable_names) + '"]'}"""
322
 
323
  print("Running on", ' '.join(command))
324
  process = subprocess.Popen(command)
325
- while True:
326
- try:
327
- process.wait()
328
- except KeyboardInterrupt:
329
- process.kill()
330
 
331
  return get_hof()
332
 
 
322
 
323
  print("Running on", ' '.join(command))
324
  process = subprocess.Popen(command)
325
+ try:
326
+ process.wait()
327
+ except KeyboardInterrupt:
328
+ process.kill()
 
329
 
330
  return get_hof()
331