ellipsoid_fit_python icon indicating copy to clipboard operation
ellipsoid_fit_python copied to clipboard

Unexpected results on sets of points

Open ismaelGomez87 opened this issue 5 years ago • 7 comments

Hi @aleksandrbazhin,

I am interested on using your code for some applications on molecular characterization. However, when I compute the ellipsoid for certain point sets I find unexpected results. See below the screenshots of the outcome.

Set1 Set2

I also find the following warning when running over the 1st set:

plot_ellipsoid.py:19: RuntimeWarning: invalid value encountered in double_scalars
  r = (a * b * c) ** (1. / 3.)

Could you please assist? I can share the data if needed.

Best, Ismael.

ismaelGomez87 avatar Dec 26 '19 10:12 ismaelGomez87

Hi. Glad that the code is helpful. You can try disabling data regularization as it just throws out some of the points which is useful mainly for magnetometer calibrations. I will try to research the problems you are facing if you provide datasets which cause errors.

aleksandrbazhin avatar Dec 27 '19 07:12 aleksandrbazhin

Also the code computes only the closest ellipsoid to the one with data points on its surface not enclosing all the points. Your data seem to be not suited for that and your results may as well be the closest to that kind of ellipsoids.

aleksandrbazhin avatar Dec 27 '19 07:12 aleksandrbazhin

I think what you need is minimum value enclosing ellipsoid like https://github.com/minillinim/ellipsoid

aleksandrbazhin avatar Dec 27 '19 12:12 aleksandrbazhin

Another option which may be good enough for classification is to construct a convex hull first, then compute an ellipsoid fitting it with this (my) repo.

aleksandrbazhin avatar Dec 30 '19 00:12 aleksandrbazhin

Hi @aleksandrbazhin,

thanks for your replies. What I need is to adjust an ellipsoid with minimum error to a set of points that are not necessarily placed in a 2D manifold (i.e. there may be no surface embedded in 3D that has all the points). If I understand correctly, your code wouldn't be suited for this task. Would the one you linked work for this?

I could construct the convex hull and select the points that are placed in the surface. Would that be enough to build an ellipsoid with your code?

Thanks, Ismael.

ismaelGomez87 avatar Jan 02 '20 11:01 ismaelGomez87

Yes, the code I linked seems to do the job - find the minimal ellipsoid to contain all the points, but I did not look into the code. The convex hull method also should work. There is a built-in method into scipy package for convex hull construction. You should try both in my opinion and decide what works best. Or look for something else suited for your data.

aleksandrbazhin avatar Jan 02 '20 12:01 aleksandrbazhin

Tried to describe my view on situation at #11

aleksandrbazhin avatar Jul 22 '20 06:07 aleksandrbazhin