sampling.mm.phisort

sampling.mm.phisort(X3D, q=2.0, p=1.0)

Ranks multiple sampling plans stored in a 3D array by the Morris-Mitchell numerical quality metric (mmphi). Uses a simple bubble-sort: sampling plans with smaller mmphi values are placed first in the index array.

Parameters

Name Type Description Default
X3D np.ndarray A 3D array of shape (n, d, m), where m is the number of sampling plans. required
q float Exponent for the mmphi metric. Defaults to 2.0. 2.0
p float Distance norm for mmphi. p=1 is Manhattan; p=2 is Euclidean. Defaults to 1.0. 1.0

Returns

Name Type Description
np.ndarray np.ndarray: A 1D integer array of length m, giving the plan indices in ascending order of mmphi. The first index in the returned array corresponds to the numerically lowest mmphi value.

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 phisort
    from spotoptim.sampling.mm import bestlh
    X1 = bestlh(n=5, k=2, population=5, iterations=10)
    X2 = bestlh(n=5, k=2, population=15, iterations=20)
    X3 = bestlh(n=5, k=2, population=25, iterations=30)
    # Map X1 and X2 so that X3D has the two sampling plans in X3D[:, :, 0] and X3D[:, :, 1]
    X3D = np.array([X1, X2])
    print(phisort(X3D))
    X3D = np.array([X3, X2])
    print(phisort(X3D))
        [2 1]
        [1 2]