-
Notifications
You must be signed in to change notification settings - Fork 74
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
Proposal: unify kriging routines #79
Comments
It would also be good to use the pseudo-inverse, if the kriging matrix is singular. When using the Covariance matrix, we could also use SVD to invert the matrix as suggested here: The fully inverted kriging matrix could then be calculated by using the inversion rules for block matrices: |
Great idea! And nice research, the solution from the stackoverflow link is pretty funny. What about performance? - Do you have any idea at what expense the flexibility will come? |
The try-except block doesn't include any overhead, when the current implementation succeeds. The pinv takes about 5 times more time to compute the inverse (if we have numpy 1.17, which brings the import numpy as np
a = np.random.random((1000, 1000))
a += a.T
import timeit
%timeit np.linalg.inv(a)
94.8 ms ± 5.18 ms per loop (mean ± std. dev. of 7 runs, 10 loops each)
%timeit np.linalg.pinv(a)
1.17 s ± 76.4 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)
%timeit np.linalg.pinv(a, hermitian=True)
452 ms ± 25.6 ms per loop (mean ± std. dev. of 7 runs, 1 loop each) |
Actually, I mean the fully flexible approach, not just the pseudo inverse. That's a thing we should definitely do. |
Sorry for getting you wrong. The flexible approach is not including any overhead. At the time of coding I was just not aware, that kriging can always be formulated using the covariance function instead of the variogram function (in case of finite sill and stationary models, which we always assume). So we get rid of the different approaches for creating the kriging matrix, since every method only extends the matrix: simple -> ordinary -> (ext)drift And I propose to simply use this hierarchy and extend the matrix if needed. |
As seen in #89, sometimes a
|
I just noticed, that So we could use this one, without increasing any required versions. |
This was resolved with #97 |
Since all kriging routines could be reformulated in order to use the covariance matrix instead of the variogram matrix, we could unify the kriging base class to serve as a swiss knife for kriging.
All other kriging routines are then just a shortcut with a limited input parameter list.
The text was updated successfully, but these errors were encountered: