Kernel-based search¶
This section documents kernel-based search utilities provided by eb-optimization.
Kernel-based search utilities support continuous or adaptive exploration of parameter spaces by leveraging kernel functions to model response surfaces and guide optimization.
eb_optimization.search.kernels
¶
Generic discrete-search kernels for eb-optimization.
This module defines mechanical optimization primitives for selecting an argmin or argmax over a finite candidate set.
Responsibilities
- Iterate over a discrete candidate set
- Evaluate a scalar objective function
- Apply deterministic tie-breaking rules
- Return the selected candidate and its score
Non-responsibilities
- Defining candidate grids (handled by
search.grid) - Computing domain-specific objectives (e.g., cost, HR@τ, utility)
- Inspecting data distributions or residuals
- Returning diagnostics, plots, or policies
Design philosophy
These kernels are intentionally simple, deterministic, and domain-agnostic.
They serve as reusable building blocks for higher-level tuning logic
(tuning modules), enabling consistent and auditable optimization behavior
across the Electric Barometer ecosystem.
argmin_over_candidates(candidates, score_fn, *, tie_break='first')
¶
Select the candidate that minimizes a scalar score.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
candidates
|
Iterable[T]
|
Iterable of candidate values (e.g., floats, ints, tuples). |
required |
score_fn
|
Callable[[T], float]
|
Function mapping a candidate to a scalar score. |
required |
tie_break
|
Literal['first', 'last', 'closest_to_zero']
|
Deterministic tie-breaking rule:
- |
'first'
|
Returns:
| Type | Description |
|---|---|
(best_candidate, best_score)
|
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
argmax_over_candidates(candidates, score_fn, *, tie_break='first')
¶
Select the candidate that maximizes a scalar score.
This is the argmax analogue of argmin_over_candidates.