Skip to main content

scirs2_optimize/multi_fidelity/
mod.rs

1//! Multi-fidelity optimization: Hyperband and Successive Halving.
2//!
3//! This module provides resource-efficient hyperparameter optimization via
4//! early-stopping strategies.
5//!
6//! - [`SuccessiveHalving`] allocates a fixed budget across configurations and
7//!   iteratively discards the worst performers.
8//! - [`Hyperband`] runs multiple brackets of Successive Halving with varying
9//!   aggressiveness to hedge against the unknown ideal trade-off.
10//!
11//! # Quick start
12//!
13//! ```rust
14//! use scirs2_optimize::multi_fidelity::{
15//!     Hyperband, MultiFidelityConfig, ConfigSampler,
16//! };
17//!
18//! let config = MultiFidelityConfig {
19//!     max_budget: 81.0,
20//!     min_budget: 1.0,
21//!     eta: 3,
22//!     ..Default::default()
23//! };
24//!
25//! let hb = Hyperband::new(config).expect("valid config");
26//! let bounds = vec![(-5.0, 5.0), (-5.0, 5.0)];
27//! let mut rng = 42u64;
28//!
29//! let result = hb.run(
30//!     &|x: &[f64], _budget: f64| Ok(x.iter().map(|v| v * v).sum()),
31//!     &bounds,
32//!     &ConfigSampler::Random,
33//!     &mut rng,
34//! ).expect("optimization ok");
35//!
36//! println!("Best: {:?} -> {:.6}", result.best_config, result.best_objective);
37//! ```
38
39pub mod hyperband;
40pub mod successive_halving;
41pub mod types;
42
43// Re-exports
44pub use hyperband::Hyperband;
45pub use successive_halving::SuccessiveHalving;
46pub use types::{ConfigSampler, EvaluationResult, MultiFidelityConfig, MultiFidelityResult};