gloss — top-level API

The main GLOSS class is the recommended entry point for almost all use cases.

class gloss.gloss.GLOSS[source]

Bases: object

Global-Local Optimization Surrogate Strategy.

__init__(space, mode='continuous', direction='minimize', window_radius=None, unexplored_threshold=None, n_random_samples=10000, n_top_for_optimization=10, cv_folds=5, scoring='neg_root_mean_squared_error', duplicate_tolerance=None, custom_sampler=None, ucb_kappa=2.0, kappa_schedule='fixed', kappa_min=0.5, kappa_decay=0.9, n_rounds=20, adaptive_strategy=False, default_batch_size=8, distance_metric='euclidean', diversity_radius=0.0, diversity_metric='euclidean', local_top_k=None, seed=None)[source]
reset()[source]

Clear internal state.

feedback(results_with_y, current_best_before)[source]

Update bandit allocation based on which strategy improved best-so-far.

Parameters:
  • results_with_y – list of result dicts from recommend(), each with ‘strategy’, ‘point’, and ‘y_actual’ (added by user).

  • current_best_before – best y value before this batch was evaluated.

recommend(X_train=None, y_train=None, surrogate=None, X_existing=None, strategy_points=None)[source]

Recommend sample points using four strategies.

Search space

class gloss.space.SearchSpace[source]

Bases: object

Manages search space definition, constraint filtering, and sampling.

__init__(mode, bounds=None, candidates=None, param_grid=None, constraints=None, custom_sampler=None, seed=None)[source]
sample(n, rng=None)[source]

Sample n feasible points from the space.

get_candidates_excluding(excluded, tolerance=0.0)[source]

Utilities

gloss.utils.space_diagonal(bounds)[source]

Compute the diagonal length of the bounding box.

gloss.utils.compute_min_distances(points, reference)[source]

For each point, compute the minimum Euclidean distance to any reference point.

Returns inf for all points if reference is empty.

gloss.utils.is_duplicate(point, excluded, tolerance=0.0)[source]

Check if point is a duplicate of any point in excluded set.