diff --git a/pysr/regressor_sequence.py b/pysr/regressor_sequence.py index e2b7bcab..efd42bd9 100644 --- a/pysr/regressor_sequence.py +++ b/pysr/regressor_sequence.py @@ -240,7 +240,7 @@ def from_file( cls, equation_file: PathLike, *pysr_args, - recursive_history_length: Optional[int] = None, + recursive_history_length: int, binary_operators: Optional[List[str]] = None, unary_operators: Optional[List[str]] = None, n_features_in: Optional[int] = None, @@ -251,6 +251,8 @@ def from_file( ): pkl_filename = _csv_filename_to_pkl_filename(equation_file) + assert recursive_history_length is not None and recursive_history_length > 0 + # Try to load model from .pkl print(f"Checking if {pkl_filename} exists...") if os.path.exists(pkl_filename): @@ -272,7 +274,7 @@ def from_file( if "equations_" not in model.__dict__ or model.equations_ is None: model._regressor.refresh() - model.recursive_history_length = 2 # DELETE THIS LATER + model.recursive_history_length = recursive_history_length return model # Else, we re-create it.