Open valentinaalb opened 9 months ago
Hi! I haven't used the code for some time. Buy that's what I think on the spot. It's a least squares method so what we are optimizing for (minimizing) is a sum of all the squared distances between the points and the surface. I can look into the code later If you need help extracting it. You then may take a square root of it and divide it first by the number of points, and then by the mean ellipsoid axis. That would be some reasonable relative uncertainty metric.
I maybe wrong here, but I think what you need to look into is computing the residual of that solve https://github.com/aleksandrbazhin/ellipsoid_fit_python/blob/bfab4ce68244529640496f466a4374ef15748275/ellipsoid_fit.py#L125
Firstly, thanks for answering! I'm looking exactly at that by replacing np.linalg.solve() with np.linalg.lstsq(), which returns also the residual. Now I'm looking into a meaningful way to normalize it! Thanks a lot!
np.linalg.solve() is slightly different from np.linalg.lstsq(), solve() can be both more precise and efficient. Residual computation is not hard, you just need to take the difference between substituted solution and rhs of the equation. Something like D.dot(u) - d2.
Although I may be vastly wrong in all of this.
You may also look into https://github.com/marksemple/pyEllipsoid_Fit/blob/master/ellipsoid_fit.py - it's another Python port of the same matlab code
Hi! Thank you a lot for your code, it has been really helpful! Do you have any idea on how to extract the uncertainty of the fit?
Best regard!