sampling.mm.mmphi

sampling.mm.mmphi(X, q=2.0, p=1.0, verbosity=0)

Calculates the Morris-Mitchell sampling plan quality criterion.

Parameters

Name Type Description Default
X np.ndarray A 2D array representing the sampling plan, where each row is a point in d-dimensional space (shape: (n, d)). required
q float Exponent used in the computation of the metric. Defaults to 2.0. 2.0
p float The distance norm to use. For example, p=1 is Manhattan (L1), p=2 is Euclidean (L2). Defaults to 1.0. 1.0
verbosity int If set to 1, prints additional information about the computation. Defaults to 0 (no additional output). 0

Returns

Name Type Description
float float The space-fillingness metric Phiq. Larger values typically indicate a more space-filling plan according to the Morris-Mitchell criterion.

Notes

Many thanks to the original author of this code, A Sobester, for providing the original Matlab code under the GNU Licence. Original Matlab Code: Copyright 2007 A Sobester: “This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU General Public License and GNU Lesser General Public License along with this program. If not, see http://www.gnu.org/licenses/.”

Examples

>>> import numpy as np
>>> from spotoptim.sampling.mm import mmphi
>>> # Simple 3-point sampling plan in 2D
>>> X = np.array([
...     [0.0, 0.0],
...     [0.5, 0.5],
...     [1.0, 1.0]
... ])
>>> # Calculate the space-fillingness metric with q=2, using Euclidean distances (p=2)
>>> quality = mmphi(X, q=2, p=2)
>>> print(quality)
# This value indicates how well points are spread out, with smaller being better.