MilesCranmer commited on
Commit
b70dcd7
·
2 Parent(s): 486a267 1e13cd6

Merge branch 'master' into DhananjayAshok-master

Browse files
Files changed (1) hide show
  1. pysr/sr.py +3 -3
pysr/sr.py CHANGED
@@ -355,7 +355,7 @@ def _create_julia_files(dataset_filename, def_datasets, hyperparam_filename, de
355
  if len(variable_names) == 0:
356
  varMap = "[" + ",".join([f'"x{i}"' for i in range(X.shape[1])]) + "]"
357
  else:
358
- varMap = "[" + ",".join(variable_names) + "]"
359
 
360
  if weights is not None:
361
  print(f'EquationSearch(X, y, weights=weights, niterations={niterations:d}, varMap={varMap}, options=options, numprocs={procs})', file=f)
@@ -365,8 +365,8 @@ def _create_julia_files(dataset_filename, def_datasets, hyperparam_filename, de
365
 
366
  def _make_datasets_julia_str(X, X_filename, weights, weights_filename, y, y_filename, **kwargs):
367
  def_datasets = """using DelimitedFiles"""
368
- np.savetxt(X_filename, X, delimiter=',')
369
- np.savetxt(y_filename, y.reshape(-1, 1), delimiter=',')
370
  if weights is not None:
371
  np.savetxt(weights_filename, weights.reshape(-1, 1), delimiter=',')
372
  def_datasets += f"""
 
355
  if len(variable_names) == 0:
356
  varMap = "[" + ",".join([f'"x{i}"' for i in range(X.shape[1])]) + "]"
357
  else:
358
+ varMap = "[" + ",".join(['"' + vname + '"' for vname in variable_names]) + "]"
359
 
360
  if weights is not None:
361
  print(f'EquationSearch(X, y, weights=weights, niterations={niterations:d}, varMap={varMap}, options=options, numprocs={procs})', file=f)
 
365
 
366
  def _make_datasets_julia_str(X, X_filename, weights, weights_filename, y, y_filename, **kwargs):
367
  def_datasets = """using DelimitedFiles"""
368
+ np.savetxt(X_filename, X.astype(np.float32), delimiter=',')
369
+ np.savetxt(y_filename, y.reshape(-1, 1).astype(np.float32), delimiter=',')
370
  if weights is not None:
371
  np.savetxt(weights_filename, weights.reshape(-1, 1), delimiter=',')
372
  def_datasets += f"""