Skip to main content
Version: v2603

General-Purpose Strategies

This page describes the general-purpose strategies that can be used with any Preset. For preset-specific strategies, see the documentation for each preset.

random

Samples parameters randomly.

Parameters are sampled according to their type:

Parameter TypeSampling Method
IntParameterRandom selection based on step size when step is specified; uniform distribution over [low, high] otherwise
FloatParameterUniform distribution in log space when log=True, linear space otherwise
CategoricalParameterUniform random selection from choices
BoolParameterUniform random selection from True/False

Options:

ParameterDescriptionDefault
seedRandom seed for reproducibilityNone

The search continues until the trial budget (--n-trials) is exhausted.

grid

Exhaustively searches all parameter combinations.

Generates value lists for each parameter and evaluates all combinations via itertools.product. Value list generation depends on the parameter type:

Parameter TypeValue List Generation
IntParameterrange(low, high+1, step) when step is specified; grid_points evenly spaced values otherwise
FloatParametergrid_points evenly spaced values in log space when log=True, linear space otherwise
CategoricalParameterAll choices
BoolParameter[True, False]

Options:

ParameterDescriptionDefault
grid_pointsNumber of grid points for parameters without an explicit step size5

The search automatically terminates when all combinations have been evaluated. Best suited for small search spaces.

optuna

Samples parameters using Optuna's Sampler. By default, uses TPE (Tree-structured Parzen Estimator), which prioritizes exploring promising parameter regions based on past trial results.

Options:

ParameterDescriptionDefault
samplerOptuna sampler instanceTPESampler
storageOptuna storage URL (e.g., sqlite:///study.db)None
study_nameOptuna study nameNone

Specifying storage persists the search results, enabling interruption and resumption.