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

josef-pkt
Copy link
Member

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
Copy link
Member Author

@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
Copy link

Coverage Status

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

@josef-pkt
Copy link
Member Author

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

josef-pkt added a commit that referenced this pull request Dec 19, 2013
REF: Results.predict convert to array and adjust shape
@josef-pkt josef-pkt merged commit 0b5ed74 into statsmodels:master Dec 19, 2013
@josef-pkt josef-pkt deleted the fix_predict_1032 branch December 19, 2013 16:28
PierreBdR pushed a commit to PierreBdR/statsmodels that referenced this pull request Sep 2, 2014
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
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Poisson predict breaks on list
2 participants