Use pseudo inverse to prevent singular matrices#151
Conversation
|
And another note: |
|
Are we confident that the matrix we are trying to invert is always Hermetian/symmetric? Also at least in |
|
Yepp, the symmetry of the kriging matrix is a property we can use. We could also solve it, but we should use I could check, if that solves the problem above. |
|
Problem is: |
|
For some strange reason, one test is failing with @rth since the inversion in I would add a switch to use the pseudo-inverse, so the current behavior stays the same and user can enable the pseudo-inverse, if they need it. |
|
I will implement a switch
Then everything will stay as it is and the users can select other routines for the inversion. |
|
I now decided to add two new keywords to the Kriging class So the current behavior is conserved and the usage of the pseudo-inverse can be opted in. @rth : Are you OK with that? |
|
@rth ping. :-) |
|
I think, I'll just merge this by next week! |
rth
left a comment
There was a problem hiding this comment.
Thanks @MuellerSeb , sorry for late response. Generally LGTM but I haven't done a very thorough review.
One comment is that it might be better to use string options for pseudo_inv_type, as UniversalKrigging(pseudo_inv_type='pinvh') is more explicit/readable than UniversalKrigging(pseudo_inv_type=3).
This is adressing #87, #150 and others.
The pseudo-inverse eventually solves the system by the least square error solution of the kriging equation. This helps to solve over-/under-determined systems.
If there are redundant points, their values will be averaged in the resulting krige field.
This feature can be pluged in via a switch in the init routines of Ordinary and Universal kriging in 2D/3D.