You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Would it be useful to have a clone method that returns a clean shallow (or deep) copy of a model instance with anything that has been attached during fit stripped off?
I think we are supposed to do this with init_keys, something like this:
init_args = **{k: getattr(old_model, k) for k in old_model.init_keys}
`new_model = GLM(old_model.endog, old_model.exog, init_args)
However some of the more complex models do a lot of pre-processing in init. For example, Cox regression pre-computes a bunch of indices, and GEE categorical (nominal/ordinal) restructures the data using binary indicators. I don't see an easy way to get a clean model instance in these cases without repeating these expensive actions.
A further complication is that some arguments to init, like cov_struct in GEE, are themselves object instances with attributes that may be altered during fit. So these might need their own clone methods.
The use case is meta-procedures like bootstrapping and sensitivity analyses where we need to refit a model many times.
Activity
kshedden commentedon Jul 22, 2014
Other possibilities:
josef-pkt commentedon Jul 22, 2014
this is essentially a duplicate of #1093
josef-pkt commentedon Jan 11, 2015
closing as duplicate, see 1093