Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

oseiskar
Copy link
Contributor

Using unsymmetric or indefinite matrices break Kalman filter math and may result to random "division by zero" -type errors inside the libraries.

@NoaWegerhoff

Using unsymmetric or indefinite matrices break Kalman filter
math and may result to random "division by zero" -type errors
inside the libraries.
@fkiraly fkiraly added module:transformations transformations module: time series transformation, feature extraction, pre-/post-processing enhancement Adding new functionality labels Mar 23, 2025
Copy link
Collaborator

@fkiraly fkiraly left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense - quick question, why does the test not break currently if the matrix is not psd?

@oseiskar
Copy link
Contributor Author

In practice, it's pretty bad luck if the matrices randomly end up singular, and the Kalman filter equations are also well-defined for non-symmetric matrices. However, they just don't make sense if the matrix is not symmetric PSD, so whatever is happening inside the implementations with such matrices is, from the math point of view, undefined behavior.

It's also hard to say if the algorithms (including EM) should be numerically stable with such data. I would not be suprised if this resulted in random occasional test failures but cannot really describe the exact mechanism why that would happen.

It would also be legal for a Kalman Filter library to implement the matrix inversion step inside the KF equations by a few different ways, e.g., Cholesky decomposition, LU etc., and these may give different results if the matrix is assumed to be symmetric, but is actually not.

Copy link
Collaborator

@fkiraly fkiraly left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense to me. We were testing an unexpected input.

@fkiraly fkiraly merged commit 859e292 into sktime:main Mar 27, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Adding new functionality module:transformations transformations module: time series transformation, feature extraction, pre-/post-processing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants