Mexican hat generator: the Ricker wavelet surface.
Evaluates the negative second derivative of a Gaussian, a radially symmetric surface with a central peak ringed by a trough. Its sharp curvature near the origin makes it a good stress test for smoothers and local regressors.
Classes
Mexican Hat (Ricker wavelet) data generator.
Generates data using the Mexican Hat function, which is the negative second derivative of a Gaussian:
y = \left(1 - \frac{r^2}{\sigma^2}\right) \exp\left(-\frac{r^2}{2\sigma^2}\right)
where r is the distance from the center.
Constructor
__init__( self, n_samples: int = 100, n_features: int = 2, amplitude: float = 1.0, sigma: float = 1.0, noise: float = 0.0, random_state: Optional[int] = None, )
Parameters
n_samples
int
= 100
Number of samples to generate.
n_features
int
= 2
Number of features (default: 2 for visualization).
amplitude
float
= 1.0
Amplitude of the hat.
sigma
float
= 1.0
Width parameter of the Gaussian.
noise
float
= 0.0
Standard deviation of Gaussian noise.
random_state
int or None
= None
Random seed for reproducibility.
python
>>> from tuiml.datasets.generators.regression import MexicanHat
>>> gen = MexicanHat(n_samples=1000, sigma=1.0, random_state=0)
>>> data = gen.generate()
>>> data.X.shape
(1000, 2)