Skip to content

Commit

Permalink
added warning to missing parameters in from_file
Browse files Browse the repository at this point in the history
  • Loading branch information
tbuckworth authored Aug 22, 2024
1 parent 0b36c67 commit 716ef19
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions pysr/sr.py
Original file line number Diff line number Diff line change
Expand Up @@ -1025,6 +1025,13 @@ def from_file(
and v.kind != v.VAR_KEYWORD
}

if len(missing_params) > 0:
warnings.warn(
"The following missing parameters will be assigned with default values:"
f"{', '.join(missing_params.keys())}"
"This may be due to the model being saved under an old package version."
)

# Assign missing attributes
for k, v in missing_params.items():
setattr(model, k, v)
Expand Down

0 comments on commit 716ef19

Please sign in to comment.