sampling.mm.mmphi_corrected_update

sampling.mm.mmphi_corrected_update(
    X,
    new_point,
    J,
    d,
    q=2.0,
    p=2.0,
    normalize_flag=False,
)

Updates the corrected Morris-Mitchell criterion after adding one point.

Incrementally computes :math:\hat{\Phi}_q for the design :math:P \cup \{x_{n+1}\} using the cached distances J and d from the existing n-point design P. Only the n new distances between new_point and each existing point need to be computed, making this more efficient than calling :func:mmphi_corrected from scratch.

The corrected criterion for the updated :math:n+1 point design is:

.. math::

\hat{\Phi}_q(P \cup \{x_{n+1}\})
= \left(\frac{\sum_{j} J_j^{\prime}\, d_j^{\prime\,-q}}{
    (n+1)^{1+q/k}}\right)^{1/q}

where :math:J^{\prime} and :math:d^{\prime} are the updated multiplicities and distances, :math:n+1 is the new design size, and :math:k is the dimension of the design space.

Parameters

Name Type Description Default
X np.ndarray Existing sampling plan of shape (n, k). required
new_point np.ndarray New point to add, shape (k,). required
J np.ndarray Multiplicity array for the existing n-point design, as returned by :func:mmphi_corrected. required
d np.ndarray Unique-distance array for the existing n-point design, as returned by :func:mmphi_corrected. required
q float Exponent used in the Morris-Mitchell metric. Defaults to 2.0. 2.0
p float Distance norm (e.g., p=1 Manhattan, p=2 Euclidean). Defaults to 2.0. 2.0
normalize_flag bool If True, normalizes X and new_point to [0, 1] before computing distances. Defaults to False. False

Returns

Name Type Description
tuple[float, np.ndarray, np.ndarray] tuple[float, np.ndarray, np.ndarray]: A tuple containing: - corrected_phiq (float): Updated corrected criterion value for the n+1 point design. - updated_J (np.ndarray): Updated multiplicities array. - updated_d (np.ndarray): Updated unique-distance array.

Examples

>>> import numpy as np
>>> from spotoptim.sampling.mm import mmphi_corrected, mmphi_corrected_update
>>> X = np.array([[0.0, 0.0], [0.5, 0.5], [1.0, 1.0]])
>>> phi_hat, J, d = mmphi_corrected(X, q=2, p=2)
>>> new_point = np.array([0.25, 0.75])
>>> updated_phi, updated_J, updated_d = mmphi_corrected_update(
...     X, new_point, J, d, q=2, p=2
... )
>>> print(updated_phi)