def bounding_ellipsoids(points, pointvol=0., vol_dec=0.5, vol_check=2.):
"""
Calculate a set of ellipsoids that bound the collection of points.
Parameters
----------
points : `~numpy.ndarray` with shape (npoints, ndim)
A set of coordinates.
pointvol : float, optional
Volume represented by a single point. When provided,
used to set a minimum bound on the ellipsoid volume
as `npoints * pointvol`. Default is `0.`.
vol_dec : float, optional
The required fractional reduction in volume after splitting an
ellipsoid in order to to accept the split. Default is `0.5`.
vol_check : float, optional
The factor used to when checking whether the volume of the
original bounding ellipsoid is large enough to warrant more
trial splits via `ell.vol > vol_check * npoints * pointvol`.
Default is `2.0`.
Returns
-------
mell : :class:`MultiEllipsoid` object
The :class:`MultiEllipsoid` object used to bound the
collection of points.
"""
if not HAVE_KMEANS:
raise ValueError("scipy.cluster.vq.kmeans2 is required to compute "
"ellipsoid decompositions.") # pragma: no cover
# Calculate the bounding ellipsoid for the points possibly
# enlarged to a minimum volume.
ell = bounding_ellipsoid(points, pointvol=pointvol)
# Recursively split the bounding ellipsoid until the volume of each
# split no longer decreases by a factor of `vol_dec`.
ells = _bounding_ellipsoids(points, ell, pointvol=pointvol,
vol_dec=vol_dec, vol_check=vol_check)
return MultiEllipsoid(ells=ells)
评论列表
文章目录