sampling.mm.subset
sampling.mm.subset(X, ns)Returns a space-filling subset of a given size from a sampling plan, along with the remainder. It repeatedly attempts to substitute each point in the subset with a point from the remainder if doing so improves the Morris-Mitchell metric.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| X | np.ndarray | A 2D array representing the original sampling plan, of shape (n, d). | required |
| ns | int | The size of the desired subset. | required |
Returns
| Name | Type | Description |
|---|---|---|
| (np.ndarray, np.ndarray) | A tuple (Xs, Xr) where: - Xs is the chosen subset of size ns, with space-filling properties. - Xr is the remainder (X Xs). |
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
>>> from spotoptim.sampling.mm import subset, bestlh
X = bestlh(n=5, k=3, population=5, iterations=10)
Xs, Xr = subset(X, ns=2)
print(Xs)
print(Xr)
[[0.25 0. 0.5 ]
[0.5 0.75 0. ]]
[[1. 0.25 0.25]
[0. 1. 0.75]
[0.75 0.5 1. ]]