MilesCranmer commited on
Commit
dca10d6
1 Parent(s): cb76a81

fix: potential issue with non-standard random states

Browse files
Files changed (1) hide show
  1. pysr/sr.py +3 -3
pysr/sr.py CHANGED
@@ -1848,9 +1848,6 @@ class PySRRegressor(MultiOutputMixin, RegressorMixin, BaseEstimator):
1848
  self.X_units_ = None
1849
  self.y_units_ = None
1850
 
1851
- random_state = check_random_state(self.random_state) # For np random
1852
- seed = random_state.get_state()[1][0] # For julia random
1853
-
1854
  self._setup_equation_file()
1855
 
1856
  mutated_params = self._validate_and_set_init_params()
@@ -1878,6 +1875,9 @@ class PySRRegressor(MultiOutputMixin, RegressorMixin, BaseEstimator):
1878
  "More datapoints will lower the search speed."
1879
  )
1880
 
 
 
 
1881
  # Pre transformations (feature selection and denoising)
1882
  X, y, variable_names, X_units, y_units = self._pre_transform_training_data(
1883
  X, y, Xresampled, variable_names, X_units, y_units, random_state
 
1848
  self.X_units_ = None
1849
  self.y_units_ = None
1850
 
 
 
 
1851
  self._setup_equation_file()
1852
 
1853
  mutated_params = self._validate_and_set_init_params()
 
1875
  "More datapoints will lower the search speed."
1876
  )
1877
 
1878
+ random_state = check_random_state(self.random_state) # For np random
1879
+ seed = random_state.randint(0, 2**32) # For julia random
1880
+
1881
  # Pre transformations (feature selection and denoising)
1882
  X, y, variable_names, X_units, y_units = self._pre_transform_training_data(
1883
  X, y, Xresampled, variable_names, X_units, y_units, random_state