MilesCranmer commited on
Commit
306955e
1 Parent(s): 2fb18ff

Allow X to be 1D array

Browse files
Files changed (1) hide show
  1. pysr/sr.py +3 -0
pysr/sr.py CHANGED
@@ -195,6 +195,9 @@ def pysr(X=None, y=None, weights=None,
195
 
196
  use_custom_variable_names = (len(variable_names) != 0)
197
 
 
 
 
198
  # Check for potential errors before they happen
199
  assert len(unary_operators) + len(binary_operators) > 0
200
  assert len(X.shape) == 2
 
195
 
196
  use_custom_variable_names = (len(variable_names) != 0)
197
 
198
+ if len(X.shape) == 1:
199
+ X = X[:, None]
200
+
201
  # Check for potential errors before they happen
202
  assert len(unary_operators) + len(binary_operators) > 0
203
  assert len(X.shape) == 2