skg.nsphere_fit¶
-
skg.
nsphere_fit
(x, axis=-1, scaling=False)[source]¶ Fit an n-sphere to ND data.
The center and radius of the n-sphere are optimized using the Coope method. The sphere is described by
Parameters: - x (array-like) – The n-vectors describing the data. Usually this will be a nxm array containing m n-dimensional data points.
- axis (int) – The axis that determines the number of dimensions of the
n-sphere. All other axes are effectively raveled to obtain an
(m, n)
array. - scaling (bool) – If True, scale and offset the data to a bounding box of -1 to +1 during computations for numerical stability. Default is False.
Returns: - r (scalar) – The optimal radius of the best-fit n-sphere for x.
- c (array) – An array of size x.shape[axis] with the optimized center of the best-fit n-sphere.
References