Skip to main content

Module hyperparameter_tuner

Module hyperparameter_tuner 

Source
Expand description

Hyperparameter Tuner — Bayesian optimization and random/grid search.

Provides HyperparameterTuner supporting:

  • Random Search — sample random configurations with xorshift64 PRNG
  • Grid Search — enumerate all discrete/categorical/continuous combinations
  • Bayesian Optimization — Gaussian process surrogate with UCB acquisition

§Example

use ipfrs_tensorlogic::{
    HyperparameterTuner, TunerConfig, HpSpec, HpType, TuningStrategy,
};

let spec = HpSpec {
    name: "lr".to_string(),
    hp_type: HpType::Continuous { lo: 1e-4, hi: 1e-1 },
    log_scale: true,
};
let config = TunerConfig {
    specs: vec![spec],
    maximize: false,
    seed: 42,
};
let mut tuner = HyperparameterTuner::new(config);
let mut rng = 42u64;
let results = tuner.run_random_search(5, |cfg| {
    // Simulated scorer: extract lr, return a dummy loss
    use ipfrs_tensorlogic::HpValue;
    if let Some(HpValue::Float(lr)) = cfg.get("lr") {
        lr.abs()
    } else {
        f64::MAX
    }
}, &mut rng);
assert_eq!(results.len(), 5);

Structs§

HpConfig
A complete hyperparameter configuration (map from name to value).
HpSpec
Specification for a single hyperparameter.
HyperparameterTuner
Hyperparameter tuner supporting random search, grid search, and simplified Bayesian optimization with UCB acquisition.
TunerConfig
Configuration for HyperparameterTuner.
TunerStats
Aggregate statistics over all recorded trials.
TuningResult
The result of a single hyperparameter tuning trial.

Enums§

HpTunerError
Errors that can arise during hyperparameter tuning.
HpType
The domain type of a single hyperparameter.
HpValue
The value of a single hyperparameter in a concrete configuration.
TuningStrategy
How the tuner explores the hyperparameter space.