MilesCranmer commited on
Commit
6ab7b97
·
1 Parent(s): 3cd939f

Output parameters for local runs

Browse files
Files changed (1) hide show
  1. run_pysr_and_save.py +7 -2
run_pysr_and_save.py CHANGED
@@ -37,8 +37,10 @@ if __name__ == "__main__":
37
  try:
38
  import pysr
39
  from julia.api import JuliaInfo
 
40
  info = JuliaInfo.load(julia="/home/user/.local/bin/julia")
41
  from julia import Main as _Main
 
42
  pysr.sr.Main = _Main
43
 
44
  from pysr import PySRRegressor
@@ -59,7 +61,11 @@ if __name__ == "__main__":
59
  df = model.equations_[["equation", "loss", "complexity"]]
60
  # Convert all columns to string type:
61
  df = df.astype(str)
62
- error_message = "Success!"
 
 
 
 
63
  except Exception as e:
64
  error_message = tb.format_exc()
65
  # Dump to file:
@@ -68,4 +74,3 @@ if __name__ == "__main__":
68
  df.to_csv("pysr_output.csv", index=False)
69
  with open("error.log", "w") as f:
70
  f.write(error_message)
71
-
 
37
  try:
38
  import pysr
39
  from julia.api import JuliaInfo
40
+
41
  info = JuliaInfo.load(julia="/home/user/.local/bin/julia")
42
  from julia import Main as _Main
43
+
44
  pysr.sr.Main = _Main
45
 
46
  from pysr import PySRRegressor
 
61
  df = model.equations_[["equation", "loss", "complexity"]]
62
  # Convert all columns to string type:
63
  df = df.astype(str)
64
+ error_message = (
65
+ "Success!\n"
66
+ f"You may run the model locally (faster) with "
67
+ f"the following parameters:\n" + str(model.get_params())
68
+ )
69
  except Exception as e:
70
  error_message = tb.format_exc()
71
  # Dump to file:
 
74
  df.to_csv("pysr_output.csv", index=False)
75
  with open("error.log", "w") as f:
76
  f.write(error_message)