Nous.Eval.Optimizer.Strategies.Random (nous v0.17.1)

Copy Markdown View Source

Random search optimization strategy.

Random search samples configurations randomly from the search space. Often surprisingly effective and much faster than grid search for high-dimensional spaces.

Options

  • :n_trials - Number of trials to run (default: 100)
  • :timeout - Total timeout in ms (default: 3600000 = 1 hour)
  • :early_stop - Stop if score reaches threshold
  • :verbose - Print progress (default: true)
  • :latin_hypercube - Use Latin Hypercube Sampling for better coverage (default: false)

Example

Optimizer.optimize(suite, params,
  strategy: :random,
  n_trials: 50,
  metric: :score
)

When to Use

Random search is recommended when:

  • Search space is large (many parameters or wide ranges)
  • Some parameters are more important than others (random search explores all)
  • You have limited time/budget for optimization
  • Grid search would take too long

Latin Hypercube Sampling

Enable latin_hypercube: true for better coverage of the search space. LHS ensures samples are spread evenly across each parameter's range.