Closed
Description
TODO: motivate freezing: pipeline components, calibration, transfer/semisupervised learning
This should probably be a SLEP, but I just want it saved somewhere.
Features required for estimator freezing:
clone
must haveis isinstance(obj, FrozenModel): return obj
(or do so via class polymorphism /singledispatch
)FrozenModel
delegates all attribute access (get, set, del) to its wrapped estimator (except where specified)- hence its estimator cannot be accessible at
FrozenModel().estimator
but at some more munged name.
- hence its estimator cannot be accessible at
FrozenModel
hasdef fit(self, *args, **kwargs): return self
FrozenModel
hasdef fit_transform(self, *args, **kwargs): return fit(self, *args, **kwargs).transform(self, args[0])
(and similar forfit_predict
?)isinstance(freeze(obj), type(obj)) == True
andisinstance(freeze(obj), FrozenModel) == True
- since this is determined from
type(freeze(obj))
(excluding__instancecheck__
, which seems irrelevant), this appears to be the hardest criterion to fulfill - seems to entail use of a mixin, class created in closure, setting
__class__
(!), overloading of__reduce__
, help! I think I've gone down the wrong path!!
- since this is determined from
- must behave nicely with
pickle
andcopy.[deep]copy
freeze(some_list)
will freeze every element of the list