pulsatrix
Loading...
Searching...
No Matches
pulsatrix::SearchSpace Class Reference

Describes a hyperparameter search space as an ordered list of named, typed parameters. Every HPO algorithm (grid/random search, GP-BO, TPE, Hyperband/ASHA) consumes a SearchSpace to know what it may propose; this type itself has no sampling logic (that is each algorithm's own job, e.g. RandomSample/GridSample). More...

#include <search_space.hpp>

Public Member Functions

void AddContinuous (std::string name, double lower, double upper)
 Adds a continuous parameter sampled from [lower, upper].
 
void AddLogUniform (std::string name, double lower, double upper)
 Adds a log-uniform parameter sampled from [lower, upper] on a log scale (e.g. learning rates, where 0.001 and 0.01 should be equally likely orders of magnitude, not equally likely absolute distances).
 
void AddInteger (std::string name, int64_t lower, int64_t upper)
 Adds an integer parameter sampled from [lower, upper] (inclusive both ends).
 
void AddCategorical (std::string name, std::vector< std::string > categories)
 Adds a categorical parameter, one of categories.
 
const std::vector< ParameterSpec > & parameters () const
 Every parameter, in the order added.
 
size_t size () const
 Number of parameters in this search space.
 
const ParameterSpec & Get (const std::string &name) const
 Looks up a parameter by name.
 
bool Contains (const std::string &name) const
 Whether a parameter with this name exists.
 

Detailed Description

Describes a hyperparameter search space as an ordered list of named, typed parameters. Every HPO algorithm (grid/random search, GP-BO, TPE, Hyperband/ASHA) consumes a SearchSpace to know what it may propose; this type itself has no sampling logic (that is each algorithm's own job, e.g. RandomSample/GridSample).

Member Function Documentation

◆ AddCategorical()

void pulsatrix::SearchSpace::AddCategorical ( std::string  name,
std::vector< std::string >  categories 
)
inline

Adds a categorical parameter, one of categories.

Exceptions
std::invalid_argumentif name is already used, or categories is empty.

◆ AddContinuous()

void pulsatrix::SearchSpace::AddContinuous ( std::string  name,
double  lower,
double  upper 
)
inline

Adds a continuous parameter sampled from [lower, upper].

Exceptions
std::invalid_argumentif name is already used in this search space, or !(lower < upper).

◆ AddInteger()

void pulsatrix::SearchSpace::AddInteger ( std::string  name,
int64_t  lower,
int64_t  upper 
)
inline

Adds an integer parameter sampled from [lower, upper] (inclusive both ends).

Exceptions
std::invalid_argumentif name is already used, or lower > upper.

◆ AddLogUniform()

void pulsatrix::SearchSpace::AddLogUniform ( std::string  name,
double  lower,
double  upper 
)
inline

Adds a log-uniform parameter sampled from [lower, upper] on a log scale (e.g. learning rates, where 0.001 and 0.01 should be equally likely orders of magnitude, not equally likely absolute distances).

Exceptions
std::invalid_argumentif name is already used, lower <= 0, or !(lower < upper).

◆ Contains()

bool pulsatrix::SearchSpace::Contains ( const std::string &  name) const
inline

Whether a parameter with this name exists.

◆ Get()

const ParameterSpec & pulsatrix::SearchSpace::Get ( const std::string &  name) const
inline

Looks up a parameter by name.

Exceptions
std::out_of_rangeif no parameter with that name exists.

◆ parameters()

const std::vector< ParameterSpec > & pulsatrix::SearchSpace::parameters ( ) const
inline

Every parameter, in the order added.

◆ size()

size_t pulsatrix::SearchSpace::size ( ) const
inline

Number of parameters in this search space.


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