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

Omit expensive linear algebra when not necessary in MinTrace #171

Merged
merged 1 commit into from
Jan 31, 2023
Merged

Omit expensive linear algebra when not necessary in MinTrace #171

merged 1 commit into from
Jan 31, 2023

Conversation

mcsqr
Copy link
Contributor

@mcsqr mcsqr commented Jan 31, 2023

Context: We're experimenting with the package for rather high number of time series. Above 10k series it becomes this becomes somewhat cumbersome. Removing the unnecessary linalg invocations for the diagonal-only methods in MinTrace makes the execution somewhat (3-4 times) faster.

Note 1: I also made a version which avoids instantiating the non-diagonal parts matrix W at all and only keeps the diagonal in memory, but that's somewhat cumbersome to align with your treatment of missing values/nan-s in the covariance matrix, so I'm not commiting it here. BTW, I think your treatment of missing values is somewhat flawed: in case there are missing values/nan-s in the time series your implementation uses masking and in this way it returns some numbers but, at least in our situation, they're really bad. I personally think it's better to just fail in such cases.

Note 2: once going to really high number of time series (say >100k) the matrix inversion in MinTrace is really killing it in terms of computing time and memory requirements. However, since one only needs the application of this matrix on a vector, one could get away without the explicit inversion and just use an iterative solver like conjugate gradients or similar. I didn't try to implement it as yet, but if there's some interest from your side to make the method work for really big data, perhaps we could collaborate here.

@review-notebook-app
Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@CLAassistant
Copy link

CLAassistant commented Jan 31, 2023

CLA assistant check
All committers have signed the CLA.

@kdgutier kdgutier self-requested a review January 31, 2023 17:29
@AzulGarza AzulGarza self-requested a review January 31, 2023 17:47
Copy link
Member

@AzulGarza AzulGarza left a comment

Choose a reason for hiding this comment

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

LGTM! Thank you for this PR, @mcsqr.

We are very interested in to make the method work for big data. Please feel free to open a PR with the necessary improvements. We'll be happy to review them.

@kdgutier kdgutier merged commit a2a718d into Nixtla:main Jan 31, 2023
@kdgutier
Copy link
Collaborator

kdgutier commented Feb 3, 2023

Hey @mcsqr,

Would you be able to look at this PR: #172
with a new computation of MinTrace's P matrix?
In theory its computational cost should be orders of magnitude faster.

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.

4 participants