-
Notifications
You must be signed in to change notification settings - Fork 55
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
Negative sigma #85
Comments
It can also end up being nan when very close / on top of input data where it should be 0. |
Hey, thank you two for reporting! Can any of you confirm, that is only happening very close / at observation locations? I am just wondering if we are talking about a bug in the implementation, or numerical issues that can easily be rounded away... Maybe, at an example where this is happening, you can quickly add a scikit-gstat/skgstat/Kriging.py Line 478 in ef963b8
I am just wondering if it's the |
It only happens close to/on top of observations that I can see. We can't really guarantee that we don't try to call transform() on the exact same coords as some observation - it's quite likely to happen even. |
OK, then as a first shot I would guess that when an observation location is in the grid passed to transform, we end up with a scikit-gstat/skgstat/Kriging.py Line 286 in ef963b8
Thus, we get a nan instead of a zero. We have to keep in mind, that there are other causes for a singular matrix and therefore I would not replace the nan with a zero by default, as actually, nothing was calculated.
Would it be a possible pathway for you to use the class as is and replace the result at the indexes of input coordinates (if they match) with 0? |
I think it would be better to do this kind of cleanup in scikit-gstat, but yes, given your explanation, we can't just replace all nans with zeros. But couldn't we use the distance matrix and check for distance < 1e-14 or something and replace all those results? |
That sounds very sensible. Maybe an even larger threshold. We should set this as an attribute to the Kriging class with a default value like that. |
OrdinaryKrigin.sigma
can sometimes end up with very small negative numbers, like-1.514380e-15
very close to positions with original data. This does have some practical consequences since we're operating innp.float64
space:Since
OrdinaryKrigin.sigma
is defined assigma^2
, it is often natural to take the square root (to get values with a more sensible unit), givingNaN
in this case.The text was updated successfully, but these errors were encountered: