1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
// Copyright 2026 Thomas Santerre and Moderately AI Inc.
//
// SPDX-License-Identifier: MIT OR Apache-2.0
//! Tree-structured Parzen Estimator for Bayesian optimization.
//!
//! Implements the TPE algorithm (Bergstra et al., 2011) for categorical
//! parameter optimization. Used by prompt optimizers like `MIPROv2` to search
//! over instruction and demo set combinations.
//!
//! # Quick Start
//!
//! ```rust
//! use parzen::{
//! Direction, GammaStrategy, Study, TpeSampler, TpeSamplerConfig, TpeSamplerDeps,
//! };
//!
//! let sampler = TpeSampler::new(
//! TpeSamplerDeps { gamma_strategy: GammaStrategy::Default },
//! TpeSamplerConfig {
//! seed: 42,
//! n_startup_trials: 5,
//! prior_weight: TpeSamplerConfig::DEFAULT_PRIOR_WEIGHT,
//! },
//! );
//! let mut study = Study::new(Direction::Maximize, sampler);
//!
//! for _ in 0..20 {
//! let x = study.suggest_categorical("x", 5);
//! let score = if x == 2 { 1.0 } else { 0.1 };
//! study.complete_trial(score);
//! }
//!
//! let best = study.best_trial().unwrap();
//! assert!(best.value > 0.5);
//! ```
pub
pub
pub
pub use ;
pub use Study;
pub use ;