sampling.mm.mm

sampling.mm.mm(X1, X2, p=1.0)

Determines which of two sampling plans has better space-filling properties according to the Morris-Mitchell criterion.

Parameters

Name Type Description Default
X1 np.ndarray A 2D array representing the first sampling plan. required
X2 np.ndarray A 2D array representing the second sampling plan. required
p float The distance metric. p=1 uses Manhattan (L1) distance, while p=2 uses Euclidean (L2). Defaults to 1.0. 1.0

Returns

Name Type Description
int int - 0 if both plans are identical or equally space-filling - 1 if X1 is more space-filling - 2 if X2 is more space-filling

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 mm
>>> # Create two 3-point sampling plans in 2D
>>> X1 = np.array([[0.0, 0.0],
...                [0.5, 0.5],
...                [0.0, 1.0]])
>>> X2 = np.array([[0.1, 0.1],
...                [0.4, 0.6],
...                [0.1, 0.9]])
>>> # Compare which plan has better space-filling (Morris-Mitchell)
>>> better = mm(X1, X2, p=2.0)
>>> print(better)
# Prints either 0, 1, or 2 depending on which plan is more space-filling.