Repository navigation
CLN: Flake8 fixups and linting for statespace files (but not tests) - #4842
Conversation
| # If we had exog, then the last predicted_state has been set to NaN | ||
| # since we didn't have the appropriate exog to create it. Then, if | ||
| # we are purely forecasting, | ||
| # we are purely forecasting, TODO: Finish this sentence? |
There was a problem hiding this comment.
Thanks for catching this. How about:
# If we had exog, then the last predicted_state has been set to NaN
# since we didn't have the appropriate exog to create it. Then, if
# we are forecasting, we now have new exog that we need to put into
# the existing state_intercept array (and we will take it out, below)
| if not A.is_f_contig(): | ||
| raise ValueError() | ||
| except: | ||
| except (AttributeError, ValueError): |
There was a problem hiding this comment.
@ChadFulton I'm fairly confident this is what should be caught, but this merits another pair of eyes.
| try: | ||
| jb = self.test_normality(method='jarquebera') | ||
| except: | ||
| except Exception: # FIXME: catch something specific |
There was a problem hiding this comment.
@ChadFulton This is the next-to-last thing that needs your input.
There was a problem hiding this comment.
What do you think about just # noqa on these? Two reasons:
- These are in the summary, and I think that we want to show the summary regardless of any errors here.
- There are a whole host of exceptions that could arise from the class methods or from the functions that they call, so it might be tough to narrow down all of the possible exceptions.
There was a problem hiding this comment.
At the very least it should be exception Exception:. With just except: we will e.g. catch KeyboardInterrupt which is definitely undesired.
I'd be OK with leaving the "FIXME" here for the time being. It's a low enough priority that we don't need to fix it immediately, but high enough that it should be hard to ignore on the next pass.
There was a problem hiding this comment.
At the very least it should be exception Exception:. With just except: we will e.g. catch KeyboardInterrupt which is definitely undesired.
Good point.
I'd be OK with leaving the "FIXME" here for the time being. It's a low enough priority that we don't need to fix it immediately, but high enough that it should be hard to ignore on the next pass.
Okay, we can discuss later.
| initial_diffuse_state_cov=initial_diffuse_state_cov, | ||
| initial_stationary_state_cov=initial_stationary_state_cov) | ||
| # TODO: Should something be done with the object returned | ||
| # by init? |
There was a problem hiding this comment.
Ah, no, I think they're set in place at each recursion. I guess maybe I was originally planning something different. If you don't mind, can you replace:
# Otherwise, if using blocks, combine the elements returned by each of
# the blocks and return thosewith:
# Otherwise, if using blocks, recursively initialize them (values will be set in-place)
Codecov Report
@@ Coverage Diff @@
## master #4842 +/- ##
==========================================
+ Coverage 81.41% 81.44% +0.02%
==========================================
Files 582 582
Lines 90312 90113 -199
Branches 10108 10094 -14
==========================================
- Hits 73528 73390 -138
+ Misses 14485 14421 -64
- Partials 2299 2302 +3
Continue to review full report at Codecov.
|
| r""" | ||
| (array) Transition matrix: :math:`T~(k\_states \times k\_states \times nobs)` | ||
| (array) Transition matrix: | ||
| :math:`T~(k\_states \times k\_states \times nobs)` |
There was a problem hiding this comment.
I think this has to be on one line for Sphinx, not sure if they fixed it though.
There was a problem hiding this comment.
Other entries are on two lines, e.g. line 234-237 above:
r"""
(array) Observation covariance matrix:
:math:`H~(k\_endog \times k\_endog \times nobs)`
"""
There was a problem hiding this comment.
Is there a conclusion on what the right thing to do is here?
There was a problem hiding this comment.
Looks like you're right, that two line version works fine (e.g. https://www.statsmodels.org/dev/generated/statsmodels.tsa.statespace.representation.Representation.html)
|
Other than those comments, LGTM. Thanks! |
9f644fa to
75c09e9
Compare
df67a1e to
8091195
Compare
|
@jbrockmendel happy to merge this, but I think there are still a few outstanding changes required. |
Just implemented what I think are the remaining ones. Let me know if I missed anything. |
|
Thanks @jbrockmendel ! |
@ChadFulton The statespace files themselves are in pretty good shape, there are are a couple of points I'll comment on inline where your input will be needed in a follow-up.
After this
statespace/tests/results/*.pywill be an easy PR, then the test files will be split into a few steps because they're in less-good condition than the rest.