PineForge HPO 0.1.0
Native hyperparameter optimization for PineForge strategies
Loading...
Searching...
No Matches
pineforge::hpo::TpeSampler Class Referencefinal

Independent, single-objective Tree-structured Parzen Estimator sampler. More...

#include <pineforge/hpo/sampler.hpp>

+ Inheritance diagram for pineforge::hpo::TpeSampler:

Public Member Functions

 TpeSampler (SearchSpace space, std::uint64_t seed, ObjectiveDirection direction=ObjectiveDirection::Maximize, std::uint64_t max_candidates=0, TpeSamplerConfig config={}, CandidatePolicy candidate_policy=CandidatePolicy::SamplerDefault)
 Constructs a native TPE sampler; max_candidates == 0 means unbounded generation.
 
 ~TpeSampler () override
 
 TpeSampler (const TpeSampler &)=delete
 
TpeSampleroperator= (const TpeSampler &)=delete
 
 TpeSampler (TpeSampler &&) noexcept
 
TpeSampleroperator= (TpeSampler &&) noexcept
 
std::optional< Candidatenext () override
 Alias for ask().
 
std::optional< Candidateask ()
 Atomically issues and reserves the next candidate.
 
void tell (std::uint64_t candidate_id, double objective_value)
 Completes an outstanding candidate with its original finite objective value.
 
void abandon (std::uint64_t candidate_id)
 Removes an outstanding failed or pruned candidate without training TPE.
 
void reset () override
 Restores the seeded initial state and clears finite-space reservations.
 
std::uint64_t generated () const noexcept override
 Returns the number of candidates issued since construction or reset.
 
std::uint64_t completed () const noexcept
 Returns the number of candidates completed through tell().
 
std::uint64_t outstanding () const noexcept
 Returns the number of candidates awaiting tell() or abandon().
 
std::uint64_t duplicate_proposals_skipped () const noexcept
 Returns internal duplicate proposals rejected by a finite policy.
 
std::uint64_t seed () const noexcept
 Returns the reproducibility seed.
 
ObjectiveDirection direction () const noexcept
 Returns the configured optimization direction.
 
const TpeSamplerConfigconfig () const noexcept
 Returns the immutable TPE tuning configuration.
 
CandidatePolicy candidate_policy () const noexcept
 Returns the configured uniqueness/coverage policy.
 
- Public Member Functions inherited from pineforge::hpo::Sampler
virtual ~Sampler ()=default
 

Detailed Description

Independent, single-objective Tree-structured Parzen Estimator sampler.

Numeric dimensions use bounded Gaussian mixtures in normalized coordinates; integer and stepped-real dimensions decode onto legal grids. Boolean and categorical dimensions use smoothed weighted histograms. Fitted candidate generation samples from the good model l(x) and retains the proposal maximizing l(x) / g(x).

next() is an alias for ask(). Every returned candidate remains outstanding until tell() or abandon() receives its ID. Public methods are thread-safe, although deterministic replay requires the same ordering of ask/tell/abandon calls.

Definition at line 132 of file sampler.hpp.

Constructor & Destructor Documentation

◆ TpeSampler() [1/3]

pineforge::hpo::TpeSampler::TpeSampler ( SearchSpace  space,
std::uint64_t  seed,
ObjectiveDirection  direction = ObjectiveDirection::Maximize,
std::uint64_t  max_candidates = 0,
TpeSamplerConfig  config = {},
CandidatePolicy  candidate_policy = CandidatePolicy::SamplerDefault 
)

Constructs a native TPE sampler; max_candidates == 0 means unbounded generation.

Finite policies validate exact cardinality and budget compatibility at construction.

Exceptions
std::invalid_argumentfor invalid configuration, direction, policy, or finite policy/budget combination.

◆ ~TpeSampler()

pineforge::hpo::TpeSampler::~TpeSampler ( )
override

◆ TpeSampler() [2/3]

pineforge::hpo::TpeSampler::TpeSampler ( const TpeSampler )
delete

◆ TpeSampler() [3/3]

pineforge::hpo::TpeSampler::TpeSampler ( TpeSampler &&  )
noexcept

Member Function Documentation

◆ abandon()

void pineforge::hpo::TpeSampler::abandon ( std::uint64_t  candidate_id)

Removes an outstanding failed or pruned candidate without training TPE.

Exceptions
std::invalid_argumentwhen candidate_id is not outstanding.

◆ ask()

std::optional< Candidate > pineforge::hpo::TpeSampler::ask ( )

Atomically issues and reserves the next candidate.

Returns std::nullopt at the configured budget or exact finite-space exhaustion.

◆ candidate_policy()

CandidatePolicy pineforge::hpo::TpeSampler::candidate_policy ( ) const
inlinenoexcept

Returns the configured uniqueness/coverage policy.

Definition at line 188 of file sampler.hpp.

◆ completed()

std::uint64_t pineforge::hpo::TpeSampler::completed ( ) const
noexcept

Returns the number of candidates completed through tell().

◆ config()

const TpeSamplerConfig & pineforge::hpo::TpeSampler::config ( ) const
inlinenoexcept

Returns the immutable TPE tuning configuration.

Definition at line 186 of file sampler.hpp.

◆ direction()

ObjectiveDirection pineforge::hpo::TpeSampler::direction ( ) const
inlinenoexcept

Returns the configured optimization direction.

Definition at line 184 of file sampler.hpp.

◆ duplicate_proposals_skipped()

std::uint64_t pineforge::hpo::TpeSampler::duplicate_proposals_skipped ( ) const
noexcept

Returns internal duplicate proposals rejected by a finite policy.

◆ generated()

std::uint64_t pineforge::hpo::TpeSampler::generated ( ) const
overridevirtualnoexcept

Returns the number of candidates issued since construction or reset.

Implements pineforge::hpo::Sampler.

◆ next()

std::optional< Candidate > pineforge::hpo::TpeSampler::next ( )
overridevirtual

Alias for ask().

Implements pineforge::hpo::Sampler.

◆ operator=() [1/2]

TpeSampler & pineforge::hpo::TpeSampler::operator= ( const TpeSampler )
delete

◆ operator=() [2/2]

TpeSampler & pineforge::hpo::TpeSampler::operator= ( TpeSampler &&  )
noexcept

◆ outstanding()

std::uint64_t pineforge::hpo::TpeSampler::outstanding ( ) const
noexcept

Returns the number of candidates awaiting tell() or abandon().

◆ reset()

void pineforge::hpo::TpeSampler::reset ( )
overridevirtual

Restores the seeded initial state and clears finite-space reservations.

Exceptions
std::logic_errorwhile a candidate is outstanding, preventing a late pre-reset result from being accepted after candidate IDs are reused.

Implements pineforge::hpo::Sampler.

◆ seed()

std::uint64_t pineforge::hpo::TpeSampler::seed ( ) const
inlinenoexcept

Returns the reproducibility seed.

Definition at line 182 of file sampler.hpp.

◆ tell()

void pineforge::hpo::TpeSampler::tell ( std::uint64_t  candidate_id,
double  objective_value 
)

Completes an outstanding candidate with its original finite objective value.

Exceptions
std::invalid_argumentfor a non-finite value or non-outstanding ID.

The documentation for this class was generated from the following file: