Skip to content

Commit

Permalink
docs: update __getstate__ docstring
Browse files Browse the repository at this point in the history
  • Loading branch information
MilesCranmer authored Apr 11, 2024
1 parent 75c23d4 commit fa9d281
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions pysr/sr.py
Original file line number Diff line number Diff line change
Expand Up @@ -1057,15 +1057,8 @@ def __getstate__(self):
Handle pickle serialization for PySRRegressor.
The Scikit-learn standard requires estimators to be serializable via
`pickle.dumps()`. However, `PyCall.jlwrap` does not support pickle
serialization.
Thus, for `PySRRegressor` to support pickle serialization, the
`julia_state_stream_` attribute must be hidden from pickle. This will
prevent the `warm_start` of any model that is loaded via `pickle.loads()`,
but does allow all other attributes of a fitted `PySRRegressor` estimator
to be serialized. Note: Jax and Torch format equations are also removed
from the pickled instance.
`pickle.dumps()`. However, some attributes do not support pickling
and need to be hidden, such as the JAX and Torch representations.
"""
state = self.__dict__
show_pickle_warning = not (
Expand Down

0 comments on commit fa9d281

Please sign in to comment.