Skip to main content

entrenar/optim/hpo/types/
strategy.rs

1//! Search strategy types for HPO
2
3use serde::{Deserialize, Serialize};
4
5/// Search strategy
6#[derive(Debug, Clone, Serialize, Deserialize)]
7pub enum SearchStrategy {
8    /// Exhaustive grid search
9    Grid,
10    /// Random search
11    Random { n_samples: usize },
12    /// Bayesian optimization
13    Bayesian { n_initial: usize, acquisition: AcquisitionFunction, surrogate: SurrogateModel },
14    /// Hyperband (successive halving)
15    Hyperband {
16        max_iter: usize,
17        eta: f64, // Reduction factor (typically 3)
18    },
19}
20
21/// Acquisition function for Bayesian optimization
22#[derive(Debug, Clone, Copy, Serialize, Deserialize)]
23pub enum AcquisitionFunction {
24    /// Expected Improvement
25    ExpectedImprovement,
26    /// Upper Confidence Bound
27    UpperConfidenceBound { kappa: f64 },
28    /// Probability of Improvement
29    ProbabilityOfImprovement,
30}
31
32/// Surrogate model for Bayesian optimization
33#[derive(Debug, Clone, Copy, Serialize, Deserialize)]
34pub enum SurrogateModel {
35    /// Tree-structured Parzen Estimator (recommended)
36    TPE,
37    /// Gaussian Process
38    GaussianProcess,
39    /// Random Forest
40    RandomForest { n_trees: usize },
41}