-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Update kalman #134
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
Update kalman #134
Conversation
|
Seems good refactor to me. Good case to favor composition over On Tue, Apr 7, 2015 at 12:38 PM, John Stachurski notifications@github.com
|
|
This looks clean. Good changes. |
|
Tom has signed off, solutions updated, just need to update lecture correspondingly. |
|
The refactored version looks good to me. |
@spencerlyon2 @cc7768 @mmcky
Hi all, there was a discussion of whether or not Kalman should subclass the linear state space class (formerly LSS, now LinearStateSpace) from lss.py, or vice versa. See #115.
In retrospect I don't think subclassing is the right way to go. For example, a Kalman filter isn't a special kind of linear state space model. A better way to think of it is that a linear state space system is part of the data needed to set up a Kalman filter. The other part of the data is the prior distribution. Hence I've rewritten Kalman to take an instance of LinearStateSpace as one of its arguments. This replaces the individual matrices from the transition and observation equations.
Basically we are replacing inheritance with composition, which seems a better fit in this case.
Among the advantages of the new version of Kalman compared to the previous one are that we don't need the logic for checking the matrices, coercing them into arrays of the right shape, etc., in two places. Now it's just in lss.py. Second, once we've created an instance of LinearStateSpace we have access to its functionality if required.
All thoughts are appreciated.