MilesCranmer commited on
Commit
1fca015
1 Parent(s): 00136f0

Improve debugging statements

Browse files
Files changed (2) hide show
  1. julia/sr.jl +5 -1
  2. pysr/sr.py +1 -1
julia/sr.jl CHANGED
@@ -793,7 +793,11 @@ function fullRun(niterations::Integer;
793
  dominating = PopMember[]
794
  open(hofFile, "w") do io
795
  debug(verbosity, "\n")
796
- debug(verbosity, "Total cycles per second: $(round(Int, equations_created_per_second, sigdigits=3))\n")
 
 
 
 
797
  debug(verbosity, "Hall of Fame:")
798
  debug(verbosity, "-----------------------------------------")
799
  debug(verbosity, "Complexity \t MSE \t Equation")
 
793
  dominating = PopMember[]
794
  open(hofFile, "w") do io
795
  debug(verbosity, "\n")
796
+ if k == 1
797
+ debug(verbosity, "Total cycles per second (first round is slower due to compilation): $(round(equations_created_per_second, sigdigits=3))\n")
798
+ else
799
+ debug(verbosity, "Total cycles per second: $(round(equations_created_per_second, sigdigits=3))\n")
800
+ end
801
  debug(verbosity, "Hall of Fame:")
802
  debug(verbosity, "-----------------------------------------")
803
  debug(verbosity, "Complexity \t MSE \t Equation")
pysr/sr.py CHANGED
@@ -136,12 +136,12 @@ def pysr(X=None, y=None, weights=None, threads=4,
136
  continue
137
 
138
  def_hyperparams += op + "\n"
 
139
  first_non_char = [
140
  j for j in range(len(op))
141
  if not (op[j].isalpha() or op[j].isdigit())][0]
142
  function_name = op[:first_non_char]
143
  op_list[i] = function_name
144
- print(op_list)
145
 
146
  def_hyperparams += f"""include("{pkg_directory}/operators.jl")
147
  const binops = {'[' + ', '.join(binary_operators) + ']'}
 
136
  continue
137
 
138
  def_hyperparams += op + "\n"
139
+ # Cut off from the first non-alphanumeric char:
140
  first_non_char = [
141
  j for j in range(len(op))
142
  if not (op[j].isalpha() or op[j].isdigit())][0]
143
  function_name = op[:first_non_char]
144
  op_list[i] = function_name
 
145
 
146
  def_hyperparams += f"""include("{pkg_directory}/operators.jl")
147
  const binops = {'[' + ', '.join(binary_operators) + ']'}