MilesCranmer commited on
Commit
6644c43
·
unverified ·
1 Parent(s): a704d53

Enable adjustable maxsize

Browse files
Files changed (2) hide show
  1. gui/app.py +9 -1
  2. gui/run_pysr_and_save.py +3 -0
gui/app.py CHANGED
@@ -16,6 +16,7 @@ os.system("bash install_pysr.sh")
16
 
17
  def greet(
18
  file_obj: tempfile._TemporaryFileWrapper,
 
19
  col_to_fit: str,
20
  niterations: int,
21
  binary_operators: list,
@@ -68,6 +69,7 @@ def greet(
68
  os.system(
69
  f"python run_pysr_and_save.py "
70
  f"--niterations {niterations} "
 
71
  f"--binary_operators '{binary_operators}' "
72
  f"--unary_operators '{unary_operators}' "
73
  f"--col_to_fit {col_to_fit} "
@@ -89,7 +91,13 @@ def main():
89
  minimum=1,
90
  maximum=1000,
91
  default=40,
92
- label="Number of iterations",
 
 
 
 
 
 
93
  ),
94
  gr.inputs.CheckboxGroup(
95
  choices=["+", "-", "*", "/", "^"],
 
16
 
17
  def greet(
18
  file_obj: tempfile._TemporaryFileWrapper,
19
+ maxsize: int,
20
  col_to_fit: str,
21
  niterations: int,
22
  binary_operators: list,
 
69
  os.system(
70
  f"python run_pysr_and_save.py "
71
  f"--niterations {niterations} "
72
+ f"--maxsize {maxsize} "
73
  f"--binary_operators '{binary_operators}' "
74
  f"--unary_operators '{unary_operators}' "
75
  f"--col_to_fit {col_to_fit} "
 
91
  minimum=1,
92
  maximum=1000,
93
  default=40,
94
+ label="Number of Iterations",
95
+ ),
96
+ gr.inputs.Slider(
97
+ minimum=7,
98
+ maximum=35,
99
+ default=20,
100
+ label="Maximum Complexity"
101
  ),
102
  gr.inputs.CheckboxGroup(
103
  choices=["+", "-", "*", "/", "^"],
gui/run_pysr_and_save.py CHANGED
@@ -21,6 +21,7 @@ empty_df = pd.DataFrame(
21
  if __name__ == "__main__":
22
  parser = ArgumentParser()
23
  parser.add_argument("--niterations", type=int)
 
24
  parser.add_argument("--binary_operators", type=str)
25
  parser.add_argument("--unary_operators", type=str)
26
  parser.add_argument("--col_to_fit", type=str)
@@ -31,6 +32,7 @@ if __name__ == "__main__":
31
  unary_operators = eval(args.unary_operators)
32
  col_to_fit = args.col_to_fit
33
  filename = args.filename
 
34
 
35
  os.environ["PATH"] += ":/home/user/.local/bin/"
36
 
@@ -52,6 +54,7 @@ if __name__ == "__main__":
52
  model = PySRRegressor(
53
  update=False,
54
  progress=False,
 
55
  niterations=niterations,
56
  binary_operators=binary_operators,
57
  unary_operators=unary_operators,
 
21
  if __name__ == "__main__":
22
  parser = ArgumentParser()
23
  parser.add_argument("--niterations", type=int)
24
+ parser.add_argument("--maxsize", type=int)
25
  parser.add_argument("--binary_operators", type=str)
26
  parser.add_argument("--unary_operators", type=str)
27
  parser.add_argument("--col_to_fit", type=str)
 
32
  unary_operators = eval(args.unary_operators)
33
  col_to_fit = args.col_to_fit
34
  filename = args.filename
35
+ maxsize = args.maxsize
36
 
37
  os.environ["PATH"] += ":/home/user/.local/bin/"
38
 
 
54
  model = PySRRegressor(
55
  update=False,
56
  progress=False,
57
+ maxsize=maxsize,
58
  niterations=niterations,
59
  binary_operators=binary_operators,
60
  unary_operators=unary_operators,