Skip to content

Commit

Permalink
add recursive history length parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
wenbang24 committed Aug 10, 2024
1 parent 1ef2fc6 commit 1fe3fe3
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions pysr/regressor_sequence.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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 <equation_file>.pkl
print(f"Checking if {pkl_filename} exists...")
if os.path.exists(pkl_filename):
Expand All @@ -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.
Expand Down

0 comments on commit 1fe3fe3

Please sign in to comment.