hyperopt-core 0.1.0

Core abstractions for hyperopt-rs: Study, Trial, and the Sampler/Pruner/Storage extension traits (define-by-run HPO).
Documentation
  • Coverage
  • 73.24%
    52 out of 71 items documented2 out of 4 items with examples
  • Size
  • Source code size: 39.38 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.32 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 8s Average build duration of successful builds.
  • all releases: 8s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • mi7plus/hyperopt-rs
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • mi7plus

hyperopt-core

Core abstractions for hyperopt-rs, an Optuna-shaped hyperparameter optimization framework for Rust. This crate defines the foundational types and the three extension traits everything else plugs into:

  • [Sampler] — a pluggable search algorithm (random, grid, TPE, …).
  • [Pruner] — a pluggable early-stopping policy.
  • [Storage] — where trial history lives (in-memory, SQLite, …).

Third parties can depend on just hyperopt-core to implement a new sampler or pruner without pulling in SQLite or rayon.

Define-by-run

The search space is not declared up front. Instead the user's objective closure receives a [TrialContext] and calls suggest_* methods on it; each call records a [Distribution] and asks the active [Sampler] for a [Value]. This allows conditional/dynamic search spaces — a later suggestion can depend on an earlier one — which is the design this framework is built around.

# use hyperopt_core::*;
# fn run(study: &Study) -> Result<(), HyperoptError> {
study.optimize(|trial| {
    let x = trial.suggest_float("x", -10.0, 10.0);
    let y = trial.suggest_float("y", -10.0, 10.0);
    Ok((x - 2.0).powi(2) + (y + 3.0).powi(2)) // minimize
}, 100)?;
# Ok(()) }