Description
With this ticket, I would like to report some breakage in code involving scikit learn.
In commit b4872fe you introduce __getstate__
for the base estimator, in order to annotate it with a scikit-learn version. Problem is, that I have estimator classes that inherit from the base estimator, and also overwrite the __getstate__
method in which some temporary data is excluded from the data being pickled. The definition of the alternate __getstate__
is done via a mixin class, from which my estimator inherits. This estimator also inherits from scikit learns BaseEstimator
. Now with b4872fe BaseEstimator
defines __getstate__
which overwrites the logic in my variant of __getstate__
.
So as a rough sketch, the situation is as follows:
class MyMixin(object):
# ...
def __getstate__(self):
values_for_serialization = self.__dict__.copy()
values_for_serialization['expert_'] = None
return values_for_serialization
class MyEstimator(BaseEstimator, MyMixin):
# ...
Of course I can fix this in my codebase (and as such, I do not request an upstream fix), but I wanted to communicate what kind of subtleties overwriting standard methods can bring.