MilesCranmer commited on
Commit
1159740
1 Parent(s): 410c9a2

Need to manually fix variable names for selection to work

Browse files
Files changed (1) hide show
  1. pysr/sr.py +5 -1
pysr/sr.py CHANGED
@@ -264,11 +264,15 @@ def pysr(X, y, weights=None,
264
  variable_names = list(X.columns)
265
  X = np.array(X)
266
 
267
- use_custom_variable_names = (len(variable_names) != 0)
268
 
269
  if len(X.shape) == 1:
270
  X = X[:, None]
271
 
 
 
 
 
 
272
  _check_assertions(X, binary_operators, unary_operators,
273
  use_custom_variable_names, variable_names, weights, y)
274
  _check_for_julia_installation()
 
264
  variable_names = list(X.columns)
265
  X = np.array(X)
266
 
 
267
 
268
  if len(X.shape) == 1:
269
  X = X[:, None]
270
 
271
+ if len(variable_names) == 0:
272
+ variable_names = [f'x{i}' for i in range(X.shape[1])]
273
+
274
+ use_custom_variable_names = (len(variable_names) != 0)
275
+
276
  _check_assertions(X, binary_operators, unary_operators,
277
  use_custom_variable_names, variable_names, weights, y)
278
  _check_for_julia_installation()