Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
compass< LOSSFUNC, PARAM, BOX > Struct Template Reference

Compass Search. More...

#include <compass.h>

Public Member Functions

 BBM_IMPORT_CONFIG (LOSSFUNC)
 
 compass (LOSSFUNC &lossfunc, PARAM &param, const BOX &lower=BOX(), const BOX &upper=BOX(), Scalar tolerance=Constants::Epsilon(), Scalar stepSize=1.0, Scalar contraction=0.5, Scalar expansion=1.0, Mask mask=true)
 Constructor: compass search.
 
Value step (void)
 probe each cardinal direction, and update the parameters to the one with the lowest loss.
 
void reset (void)
 reset the step size
 
Mask is_converged (void) const
 is_converged when _step < _tolerance
 

Private Attributes

LOSSFUNC & _lossfunc
 
PARAM & _param
 
BOX _lower
 
BOX _upper
 
Value _step
 
Value _lossValue
 
std::vector< Scalar > _directions
 
Scalar _initialStep
 
Scalar _tolerance
 
Scalar _contraction
 
Scalar _expansion
 
Mask _mask
 

Detailed Description

template<typename LOSSFUNC, typename PARAM, typename BOX = PARAM>
requires concepts::lossfunction<LOSSFUNC> && concepts::parameter<PARAM> && concepts::parameter<BOX>
struct bbm::compass< LOSSFUNC, PARAM, BOX >

Compass Search.

Template Parameters
LOSSFUNC= loss function
PARAM= parameters to optimize
BOX= box constraint type (default=PARAM)

Performs a pattern search by probing each cardinal direction in the parameter space.

When the Value type is a packet, this compass search will perform N parallel searches (where N == size of the packet).

Satisfies: concepts::optimization algorithm

Constructor & Destructor Documentation

◆ compass()

compass ( LOSSFUNC &  lossfunc,
PARAM &  param,
const BOX &  lower = BOX(),
const BOX &  upper = BOX(),
Scalar  tolerance = Constants::Epsilon(),
Scalar  stepSize = 1.0,
Scalar  contraction = 0.5,
Scalar  expansion = 1.0,
Mask  mask = true 
)
inline

Constructor: compass search.

Parameters
lossfunc= loss function to minimize
param= set of parameters to optimize
lower= lower bound of box constraint
upper= upper bound of box constraint
tolerance= threshold on step size to determine convergence (default=Epsilon)
stepSize= initial step size (default=1.0)
contraction= reduction factor for step size if no probe in the cardinal directions improves the loss (default=0.5)
expansion= expansion factor for step size if a good candinal direction was found (default=1.0)

Member Function Documentation

◆ BBM_IMPORT_CONFIG()

BBM_IMPORT_CONFIG ( LOSSFUNC  )

◆ is_converged()

Mask is_converged ( void  ) const
inline

is_converged when _step < _tolerance

◆ reset()

void reset ( void  )
inline

reset the step size

◆ step()

Value step ( void  )
inline

probe each cardinal direction, and update the parameters to the one with the lowest loss.

Returns
loss after update

Member Data Documentation

◆ _contraction

Scalar _contraction
private

◆ _directions

std::vector<Scalar> _directions
private

◆ _expansion

Scalar _expansion
private

◆ _initialStep

Scalar _initialStep
private

◆ _lossfunc

LOSSFUNC& _lossfunc
private

◆ _lossValue

Value _lossValue
private

◆ _lower

BOX _lower
private

◆ _mask

Mask _mask
private

◆ _param

PARAM& _param
private

◆ _step

Value _step
private

◆ _tolerance

Scalar _tolerance
private

◆ _upper

BOX _upper
private

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