Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

REF: Results.predict convert to array and adjust shape #1254

Merged
merged 1 commit into from Dec 19, 2013

Conversation

Projects
None yet
2 participants
@josef-pkt
Copy link
Member

commented Dec 19, 2013

Results.predict
convert to ndarray, and check and adjust shape, with unit_tests

closes #1032
supersedes #1178

I tried to let pandas through, but it doesn't help. np.dot for example returns an ndarray.
I left the commented out code for testing DataFrame in the generic tests, but it needs special handling on before return.
I don't know if we have any wrapper code for predict. I didn't see any.

Some comments on the requirements

  • CountModels require 2d even if it's only a single prediction because of exog.shape[1]
  • single regressor (OLS example) needs reshape to column_vector as in AR(MA)
  • I'm not sure we always have model.exog as 2d, so I check also for 1d model.exog
  • I didn't find self.data.k_exog or self.model.data.k_exog, so I did a model.exog.shape check directly
@josef-pkt

This comment has been minimized.

Copy link
Member Author

commented Dec 19, 2013

@jseabold Do you know if there is any wrapper for predict, or any examples were predict returns a DataFrame with correct index?

This PR converts every exog to ndarray. subclasses need to handle extra arrays, like exposure in count models.

@coveralls

This comment has been minimized.

Copy link

commented Dec 19, 2013

Coverage Status

Coverage remained the same when pulling ada08b9 on josef-pkt:fix_predict_1032 into 01fd4a2 on statsmodels:master.

@josef-pkt

This comment has been minimized.

Copy link
Member Author

commented Dec 19, 2013

ready to merge IMO, unless there is a problem with DataFrames.

josef-pkt added a commit that referenced this pull request Dec 19, 2013

Merge pull request #1254 from josef-pkt/fix_predict_1032
REF: Results.predict convert to array and adjust shape

@josef-pkt josef-pkt merged commit 0b5ed74 into statsmodels:master Dec 19, 2013

1 check passed

default The Travis CI build passed
Details

@josef-pkt josef-pkt deleted the josef-pkt:fix_predict_1032 branch Dec 19, 2013

PierreBdR pushed a commit to PierreBdR/statsmodels that referenced this pull request Sep 2, 2014

Merge pull request statsmodels#1254 from josef-pkt/fix_predict_1032
REF: Results.predict convert to array and adjust shape
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.