Loading...
Searching...
No Matches
gpr::policy::VarianceThresholdPolicy Class Reference

#include <gpr/policy/TrainingPolicy.h>

Inheritance diagram for gpr::policy::VarianceThresholdPolicy:

Public Member Functions

 VarianceThresholdPolicy (double variance_threshold)
double variance_threshold () const noexcept
bool should_call_oracle (const SearchState &state) const override
 True asks the engine to make the call it was about to make.
Public Member Functions inherited from gpr::policy::TrainingPolicy
virtual ~TrainingPolicy ()=default
virtual std::vector< int > select_training_points (const std::vector< CandidatePoint > &candidates, const std::vector< Eigen::VectorXd > &current_set) const
virtual bool should_retrain_hyperparameters (const SearchState &state) const
virtual bool should_rebuild_factor (const SearchState &state) const
virtual std::vector< int > retain_training_rows (const std::vector< Eigen::VectorXd > &rows) const

Detailed Description

Call the oracle only when the posterior energy variance is strictly above variance_threshold (eV^2). A non-finite variance means the engine has no posterior yet, and the engine's own decision stands.

Definition at line 504 of file TrainingPolicy.h.

Constructor & Destructor Documentation

◆ VarianceThresholdPolicy()

gpr::policy::VarianceThresholdPolicy::VarianceThresholdPolicy ( double variance_threshold)
inlineexplicit

Definition at line 506 of file TrainingPolicy.h.

507 : variance_threshold_(variance_threshold)
508 {
509 if (!(std::isfinite(variance_threshold) && variance_threshold >= 0.0)) {
510 throw std::invalid_argument(
511 "VarianceThresholdPolicy variance_threshold must be finite "
512 "and non-negative");
513 }
514 }
double variance_threshold() const noexcept

Member Function Documentation

◆ should_call_oracle()

bool gpr::policy::VarianceThresholdPolicy::should_call_oracle ( const SearchState & state) const
inlineoverridevirtual

True asks the engine to make the call it was about to make.

Reimplemented from gpr::policy::TrainingPolicy.

Definition at line 521 of file TrainingPolicy.h.

522 {
523 if (!state.engine_would_call_oracle) return false;
524 if (!std::isfinite(state.posterior_variance)) return true;
525 return state.posterior_variance > variance_threshold_;
526 }

◆ variance_threshold()

double gpr::policy::VarianceThresholdPolicy::variance_threshold ( ) const
inlinenodiscardnoexcept

Definition at line 516 of file TrainingPolicy.h.

517 {
518 return variance_threshold_;
519 }

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