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
{{ message }}
Repository navigation
Discrete models fit_regularized save pickle fails #2685
class TestRemoveDataPicklePoissonRegularized(RemoveDataPickle):
def setup(self):
#fit for each test, because results will be changed by test
x = self.exog
np.random.seed(987689)
y_count = np.random.poisson(np.exp(x.sum(1) - x.mean()))
model = sm.Poisson(y_count, x) #, exposure=np.ones(nobs), offset=np.zeros(nobs)) #bug with default
self.results = model.fit_regularized(method='l1', disp=0, alpha=10)
#TODO: temporary, fixed in master
self.predict_kwds = dict(exposure=1, offset=0)
gives:
Traceback (most recent call last):
File "statsmodels/base/tests/test_shrink_pickle.py", line 290, in <module>
tt.test_remove_data_pickle()
File "statsmodels/base/tests/test_shrink_pickle.py", line 68, in test_remove_data_pickle
res, l = check_pickle(results._results)
File "statsmodels/base/tests/test_shrink_pickle.py", line 27, in check_pickle
cPickle.dump(obj, fh, protocol=cPickle.HIGHEST_PROTOCOL)
cPickle.PicklingError: Can't pickle <type 'instancemethod'>: attribute lookup __builtin__.instancemethod failed
To clarify: Is TestRemoveDataPicklePoissonRegularized a unit test that you wrote?
I don't see unit test for it, but I don't get this with master.
(I have my statsmodels build messed up right now and could only test and adjusted version, not the unit tests.)
Activity
[-]Discrete models fit_regularized save fails[/-][+]Discrete models fit_regularized save pickle fails[/+]josef-pkt commentedon Oct 30, 2015
@kashif Thanks for the report
To clarify: Is TestRemoveDataPicklePoissonRegularized a unit test that you wrote?
I don't see unit test for it, but I don't get this with master.
(I have my statsmodels build messed up right now and could only test and adjusted version, not the unit tests.)
kashif commentedon Oct 30, 2015
@josef-pkt yes its something i wrote locally, happy to send that as a pull request?
kashif commentedon Oct 30, 2015
@josef-pkt the same issue occurs with other discrete models too not just Poisson
josef-pkt commentedon Oct 30, 2015
I don't find any record of recent changes that might have affected this.
Can you test with master?
I need to clean up my statsmodels build for testing or developement, and can add a unit test like this later.
(just got your new comments)
Yes please open a PR with this test case and we get TravisCI to check across python versions and dependency versions.
most of the fit_regularized code is shared by all discrete models and will affect them the same way
kashif commentedon Oct 30, 2015
yes I tested with master.
ok sending pull request now...
added discrete model fit_regularized pickle test