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

Optimize distance function in kriging #58

Closed
2 tasks done
redhog opened this issue Nov 25, 2020 · 6 comments
Closed
2 tasks done

Optimize distance function in kriging #58

redhog opened this issue Nov 25, 2020 · 6 comments
Assignees

Comments

@redhog
Copy link
Collaborator

redhog commented Nov 25, 2020

When krigin, a distance function is called for each point to calculate its distance to every point in the variogrammed dataset. This might be necessary if the use has supplied their own distance metric, but if it's one of the built in scipy, we can use scipy.spatial.distance.cdist on all points instead, and if it's euclidean, we can even use scipy.spatial.cKDTree, see ttps://iliauk.wordpress.com/2016/02/16/millions-of-distances-high-performance-python/ , which would automatically cull the points farther away than the range without actually doing a distance calculation on them.

@mmaelicke
Copy link
Owner

I commented in #60 ...

@mmaelicke
Copy link
Owner

@redhog was this resolved by #60 ?

@redhog
Copy link
Collaborator Author

redhog commented Nov 30, 2020

Only half-way. I added the two subtasks above...

But the solution is to use the same method as with #60 above, including the cKDTree optimization.

@mmaelicke
Copy link
Owner

OK, great! Then I'll leave this open.

@redhog
Copy link
Collaborator Author

redhog commented Nov 30, 2020

The idea I have is to generate a pdist matrix for all observation points at the top, then select the sub-matrix for the nearby points instead of calling self.dist().
This might even be worth allowing "short circuit" for between Kriging and Variogram, that is, allow you to send in a distance matrix alongside with coordinates and values.

@redhog
Copy link
Collaborator Author

redhog commented Apr 20, 2021

@redhog redhog closed this as completed Apr 20, 2021
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 a pull request may close this issue.

2 participants