lucid  0.0.1
Lifting-based Uncertain Control Invariant Dynamics
Loading...
Searching...
No Matches
lucid::LbfgsTuner Class Referencefinal

Optimiser that uses the L-BFGS algorithm. More...

#include <LbfgsTuner.h>

Inheritance diagram for lucid::LbfgsTuner:
lucid::Tuner

Public Member Functions

 LbfgsTuner (const LbfgsParameters &parameters={})
 Construct a new LbfgsTuner with the provided parameters.
 
 LbfgsTuner (const Eigen::VectorXd &lb, const Eigen::VectorXd &ub, const LbfgsParameters &parameters={})
 Construct a new LbfgsTuner with the provided bounds and parameters.
 
 LbfgsTuner (const std::vector< std::pair< Scalar, Scalar > > &bounds, const LbfgsParameters &parameters={})
 Construct a new LbfgsTuner with the provided bounds and parameters.
 
bool is_bounded () const
 Check whether the optimisation is bounded.
 
const LbfgsParametersparameters () const
 Get read-only access to the parameters of the L-BGS optimisation.
 
std::string to_string () const override
 Obtain the string representation of this object.
 
- Public Member Functions inherited from lucid::Tuner
void tune (Estimator &estimator, ConstMatrixRef training_inputs, ConstMatrixRef training_outputs) const
 Optimise the kernel hyperparameters.
 
void tune_online (Estimator &estimator, ConstMatrixRef training_inputs, const OutputComputer &training_outputs) const
 Optimise the kernel hyperparameters.
 

Private Member Functions

void tune_impl (Estimator &estimator, ConstMatrixRef training_inputs, const OutputComputer &training_outputs) const override
 Optimise the kernel hyperparameters.
 

Private Attributes

Eigen::VectorXd lb_
 Lower bounds for the parameters. If empty, no bounds are applied.
 
Eigen::VectorXd ub_
 Upper bounds for the parameters. If empty, no bounds are applied.
 
LbfgsParameters parameters_
 Optimization parameters for the L-BFGS algorithm.
 

Detailed Description

Optimiser that uses the L-BFGS algorithm.

It optimizes the parameters of an estimator by minimizing the loss function. It can operate with or without bounds on the parameters. If bounds are provided, they must match the dimension of the solution space. Note that the solution space for isotropic estimators (i.e., those where the parameters are the same for all dimensions) will always have a dimension of 1.

Constructor & Destructor Documentation

◆ LbfgsTuner() [1/3]

lucid::LbfgsTuner::LbfgsTuner ( const LbfgsParameters & parameters = {})
explicit

Construct a new LbfgsTuner with the provided parameters.

Parameters
parametersoptimization parameters for the L-BFGS algorithm

◆ LbfgsTuner() [2/3]

lucid::LbfgsTuner::LbfgsTuner ( const Eigen::VectorXd & lb,
const Eigen::VectorXd & ub,
const LbfgsParameters & parameters = {} )
explicit

Construct a new LbfgsTuner with the provided bounds and parameters.

The solution will be constrained to the provided bounds. The size of the bounds must match the dimension of the solution space.

Precondition
lb and ub must have the same size
Parameters
lbLower bounds for the parameters
ubUpper bounds for the parameters
parametersoptimization parameters for the L-BFGS algorithm

◆ LbfgsTuner() [3/3]

lucid::LbfgsTuner::LbfgsTuner ( const std::vector< std::pair< Scalar, Scalar > > & bounds,
const LbfgsParameters & parameters = {} )
explicit

Construct a new LbfgsTuner with the provided bounds and parameters.

The solution will be constrained to the provided bounds. The size of the bounds must match the dimension of the solution space.

Parameters
boundsvector of pairs of lower and upper bounds
parametersoptimization parameters for the L-BFGS algorithm

Member Function Documentation

◆ is_bounded()

bool lucid::LbfgsTuner::is_bounded ( ) const
nodiscard

Check whether the optimisation is bounded.

Returns
true if the optimisation is bounded
false if the optimisation is not bounded

◆ parameters()

const LbfgsParameters & lucid::LbfgsTuner::parameters ( ) const
inlinenodiscard

Get read-only access to the parameters of the L-BGS optimisation.

Returns
parameters of the L-BGS optimisation

◆ to_string()

std::string lucid::LbfgsTuner::to_string ( ) const
nodiscardoverridevirtual

Obtain the string representation of this object.

Returns
string representation of this object

Reimplemented from lucid::Tuner.

◆ tune_impl()

void lucid::LbfgsTuner::tune_impl ( Estimator & estimator,
ConstMatrixRef training_inputs,
const OutputComputer & training_outputs ) const
overrideprivatevirtual

Optimise the kernel hyperparameters.

Starting from the initial guess, the optimiser finds the best hyperparameters for the kernel. It is up to the subclass to determine the optimisation algorithm used.

Note
The method must call the consolidate method of the estimator to ensure that the kernel is ready to be used.
Precondition
The number of rows in the training inputs should be equal to the number of rows in the training outputs.
Todo
If the OutputComputer becomes a bottleneck, consider having a separate method for when the outputs are available from the get-go.
Parameters
estimatorestimator to optimise
training_inputstraining input data
training_outputstraining output data. It uses an OutputComputer to compute the outputs when needed

Implements lucid::Tuner.


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