Hybrid Grid Sampler
A hybrid constraint-based sampler combining LHS and grid sampling.
Overview
Uses Latin Hypercube Sampling (LHS) for continuous features
Uses grid-like random sampling for discrete features (integer, binary, categorical)
Allows custom constraints
Parallel sampling supported
API Reference
- class mlsampler.engine.hypergrid.HyperGridSampler(config)
Bases:
BaseSamplerGrid and LHS-based sampler for even coverage of the feature space.
This sampler generates samples based on feature metadata inferred from training data. Float features are drawn by Latin Hypercube Sampling, every other dtype from a uniform grid.
- Parameters:
config (SamplerConfig) – Configuration object containing feature metadata and sampling settings.
Notes
This sampler does not support constraints.
set_constraintsraises NotImplementedError; useRandomSamplerfor constraint-based sampling.scipyis required. Its ImportError is deferred until sampling starts.- sample(n_samples: int) Any
- Parameters:
n_samples (int) – Total number of samples to generate.
- Returns:
Shape (n_samples, n_features), in the input’s column order. The same type setup was given: an object array for an array, or a pandas/polars DataFrame carrying the input’s column names and dtypes.
- Return type:
np.ndarray or DataFrame
Notes
Float features are scaled to their respective [low, high] ranges.
Integer features are sampled from the inclusive range [low, high].
Categorical features are sampled from the provided category list.
Constant features return the same value for all samples.