Skip to content

Plan Components

omnirec.runner.plan_components.Grid(values: Iterable[T]) dataclass

Bases: PlanComponentBase[T]

Exhaustive grid search over a fixed set of values.

All provided values are returned by get_values(), and the framework generates one experiment run for every combination across all Grid parameters in an algorithm_config.

Parameters:

Name Type Description Default
values Iterable[T]

The values to enumerate.

required
Example
from omnirec.runner.plan_components import Grid

config = {"max_nbrs": Grid([10, 20, 50]), "min_nbrs": 1}
# Produces three runs: max_nbrs=10, max_nbrs=20, max_nbrs=50

omnirec.runner.plan_components.RandomChoice(choices: Sequence[T], n: int) dataclass

Bases: RandomBase[T]

Random sampling of n items from a discrete list of choices.

Useful for random search over a predefined set of candidate values. The sample is drawn without replacement using the global OmniRec random state, ensuring reproducibility.

Parameters:

Name Type Description Default
choices Sequence[T]

Pool of candidate values to sample from.

required
n int

Number of values to draw.

required
Example
from omnirec.runner.plan_components import RandomChoice

config = {"max_nbrs": RandomChoice([10, 20, 50, 100, 200], n=3)}
# Picks 3 values at random from the list

omnirec.runner.plan_components.RandomRange(start: T, end: T, n: int) dataclass

Bases: RandomBase[T]

Random sampling of n values from a numeric range.

  • If both start and end are int, values are drawn without replacement from the integer range [start, end] (inclusive).
  • If either bound is a float, values are drawn independently from a uniform distribution over [start, end].

The random state is derived from the global OmniRec random seed, ensuring reproducibility.

Parameters:

Name Type Description Default
start int | float

Lower bound of the range (inclusive).

required
end int | float

Upper bound of the range (inclusive).

required
n int

Number of values to sample.

required
Example
from omnirec.runner.plan_components import RandomRange

config = {
    "learning_rate": RandomRange(0.0001, 0.01, n=4),  # 4 random floats
    "embedding_size": RandomRange(32, 256, n=3),       # 3 random ints
}