skg.nsphere¶
N-sphere fit with center and radius.
This module is a little different from the others because it fits an n-dimensional surface and because it does not have a model function because of the non-functional nature of n-spheres.
Functions
nsphere_fit (x[, axis, scaling]) |
Fit an n-sphere to ND data. |
-
skg.nsphere.
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