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.
- Hyperparameter
Tuner - Hyperparameter tuner supporting random search, grid search, and simplified Bayesian optimization with UCB acquisition.
- Tuner
Config - Configuration for
HyperparameterTuner. - Tuner
Stats - Aggregate statistics over all recorded trials.
- Tuning
Result - The result of a single hyperparameter tuning trial.
Enums§
- HpTuner
Error - 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.
- Tuning
Strategy - How the tuner explores the hyperparameter space.