function.so.noisy_sphere

function.so.noisy_sphere(X, sigma=0.1)

N-dimensional Sphere function with noise.

Parameters

Name Type Description Default
X array - like Input points with shape (n_samples, n_features) or (n_features,). Can be a 1D array for a single point or 2D array for multiple points. required
sigma float Standard deviation of the noise. Defaults to 0.1. 0.1

Returns

Name Type Description
np.ndarray np.ndarray: Function values at the input points with shape (n_samples,).

Raises

Name Type Description
ValueError If X has fewer than 1 dimension.

Note

  • Global minimum: f(0, 0, …, 0) = 0
  • Typical search domain: [-5, 10]^N or [-2, 2]^N
  • Characteristics: Convex, unimodal

Examples

from spotoptim.function import noisy_sphere
import numpy as np
X = np.array([1.0, 1.0])
noisy_sphere(X, sigma=0.1)
array([2.18128505])
from spotoptim.function import noisy_sphere
import numpy as np
X = np.array([[0.0, 0.0], [1.0, 1.0], [0.5, 0.5]])
noisy_sphere(X, sigma=0.1)
array([0.2308213 , 1.99093667, 0.5163123 ])