Minimum enclosing ellipse

· Source: Yet Another Math Programming Consultant · Field: Technology & Digital — Artificial Intelligence & Machine Learning, Data Science & Analytics · Depth: Advanced, long

Summary

This analysis details methods for finding the minimum encompassing circle and ellipse for a given set of data points, focusing on convex cases. For circles, the problem is formulated as a Nonlinear Programming (NLP) model minimizing the squared radius, R, under constraints that all points are within the circle. Using the Conopt solver with 100 random data points, the NLP model achieved an optimal solution in two iterations, benefiting from a good initial point derived from the mean of coordinates. The article also presents a conic model formulation for circles, which requires auxiliary variables for strict Second-Order Cone Program (SOCP) format. For ellipses, the problem is framed as a convex Semi-Definite Programming (SDP) problem maximizing the logarithm of the determinant of matrix A, where the ellipse is defined by $||A x+b|| \le 1$. This is solved using CVXPY with 50 data points drawn from a bivariate normal distribution, reducing to 12 convex hull points. An alternative DIY SOCP formulation for ellipses is also provided, along with NLP models that leverage an initial circle solution as a starting point.

Key takeaway

For Data Scientists or Machine Learning Engineers working with geometric optimization, understanding the nuances of NLP, conic, and SDP formulations for minimum enclosing shapes is crucial. Providing a well-calculated initial point, such as the center of mass for a circle, can significantly reduce solver iterations and improve solution reliability. Consider using convex hull reduction to simplify complex datasets before feeding them into optimization models, especially for larger point sets.

Key insights

Optimizing geometric shapes around data points benefits from convex formulations and good initial solutions.

Principles

Method

For minimum enclosing circles, use an NLP model minimizing squared radius, or a conic model with auxiliary variables. For ellipses, employ SDP or SOCP formulations maximizing the determinant of the transformation matrix.

In practice

Topics

Best for: Data Scientist, Machine Learning Engineer, Research Scientist

Related on AIssential

Open in AIssential →

Editorial summary, takeaway, and curation by AIssential. Original article published by Yet Another Math Programming Consultant.