AutonLabTruth commited on
Commit
762987c
1 Parent(s): 0dfd8e3

Refactored out paths and others

Browse files
Files changed (1) hide show
  1. pysr/sr.py +9 -8
pysr/sr.py CHANGED
@@ -192,11 +192,9 @@ def pysr(X=None, y=None, weights=None,
192
 
193
  """
194
  raise_depreciation_errors(limitPowComplexity, threads)
195
- if maxdepth is None:
196
- maxdepth = maxsize
197
- if equation_file is None:
198
- date_time = datetime.now().strftime("%Y-%m-%d_%H%M%S.%f")[:-3]
199
- equation_file = 'hall_of_fame_' + date_time + '.csv'
200
 
201
  if isinstance(X, pd.DataFrame):
202
  variable_names = list(X.columns)
@@ -209,6 +207,12 @@ def pysr(X=None, y=None, weights=None,
209
 
210
  check_assertions(X, binary_operators, unary_operators, use_custom_variable_names, variable_names, weights, y)
211
 
 
 
 
 
 
 
212
  if select_k_features is not None:
213
  selection = run_feature_selection(X, y, select_k_features)
214
  print(f"Using features {selection}")
@@ -239,9 +243,6 @@ def pysr(X=None, y=None, weights=None,
239
  y = eval(eval_str)
240
  print("Running on", eval_str)
241
 
242
- X_filename, dataset_filename, hyperparam_filename, operator_filename, pkg_filename, runfile_filename, tmpdir, weights_filename, y_filename = set_paths(
243
- tempdir)
244
-
245
  def_hyperparams = ""
246
 
247
  # Add pre-defined functions to Julia
 
192
 
193
  """
194
  raise_depreciation_errors(limitPowComplexity, threads)
195
+ X_filename, dataset_filename, hyperparam_filename, operator_filename, pkg_filename, runfile_filename, tmpdir, \
196
+ weights_filename, y_filename = set_paths(tempdir)
197
+
 
 
198
 
199
  if isinstance(X, pd.DataFrame):
200
  variable_names = list(X.columns)
 
207
 
208
  check_assertions(X, binary_operators, unary_operators, use_custom_variable_names, variable_names, weights, y)
209
 
210
+ if maxdepth is None:
211
+ maxdepth = maxsize
212
+ if equation_file is None:
213
+ date_time = datetime.now().strftime("%Y-%m-%d_%H%M%S.%f")[:-3]
214
+ equation_file = 'hall_of_fame_' + date_time + '.csv'
215
+
216
  if select_k_features is not None:
217
  selection = run_feature_selection(X, y, select_k_features)
218
  print(f"Using features {selection}")
 
243
  y = eval(eval_str)
244
  print("Running on", eval_str)
245
 
 
 
 
246
  def_hyperparams = ""
247
 
248
  # Add pre-defined functions to Julia