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

Interface for objects that can be optimised using gradient-based methods (e.g., LbfgsTuner). More...

#include <GradientOptimizable.h>

Inheritance diagram for lucid::GradientOptimizable:
lucid::Estimator lucid::Parametrizable lucid::KernelRidgeRegressor

Public Member Functions

double objective_value () const
 Get read-only access to the objective value of the this object.
 
const Vector & gradient () const
 Get read-only access to the gradient of the this object.
 
- Public Member Functions inherited from lucid::Estimator
 Estimator (Parameters parameters=NoParameters, const std::shared_ptr< const Tuner > &tuner=nullptr)
 Construct a new Estimator object.
 
Matrix operator() (ConstMatrixRef x) const
 A model is a function that takes a \( n \times d_x \) matrix of row vectors in the input space \( \mathcal{X} \) and returns a \( n \times d_y \) matrix of row vectors in the output space \( \mathcal{Y} \).
 
virtual Matrix predict (ConstMatrixRef x) const =0
 A model is a function that takes a \( n \times d_x \) matrix of row vectors in the input space \( \mathcal{X} \) and returns a \( n \times d_y \) matrix of row vectors in the output space \( \mathcal{Y} \).
 
Estimatorfit (ConstMatrixRef training_inputs, ConstMatrixRef training_outputs, const Tuner &tuner)
 Fit the model to the given data.
 
Estimatorfit (ConstMatrixRef training_inputs, ConstMatrixRef training_outputs)
 Fit the model to the given data.
 
Estimatorfit_online (ConstMatrixRef training_inputs, const OutputComputer &training_outputs, const Tuner &tuner)
 Fit the model to the data produced by the training_outputs OutputComputer.
 
Estimatorfit_online (ConstMatrixRef training_inputs, const OutputComputer &training_outputs)
 Fit the model to the data produced by the training_outputs OutputComputer.
 
Estimatorconsolidate (ConstMatrixRef training_inputs, ConstMatrixRef training_outputs, const Request request=Request::_)
 Consolidate the model, making sure it is ready for use.
 
Estimatorconsolidate (ConstMatrixRef training_inputs, ConstMatrixRef training_outputs, Requests requests)
 Consolidate the model, making sure it is ready for use.
 
virtual double score (ConstMatrixRef evaluation_inputs, ConstMatrixRef evaluation_outputs) const =0
 Score the estimator assigning a numerical value to its accuracy in predicting the evaluation_outputs given the evaluation_inputs.
 
const std::shared_ptr< const Tuner > & tuner () const
 Get read-only access to the tuner of the estimator.
 
std::shared_ptr< const Tuner > & m_tuner ()
 Get read-write access to the tuner of the estimator.
 
virtual std::unique_ptr< Estimatorclone () const =0
 Clone the estimator by creating a new instance with the same parameters.
 
virtual std::string to_string () const
 Obtain the string representation of this object.
 
- Public Member Functions inherited from lucid::Parametrizable
template<IsAnyOf< int, double, const Vector & > T>
get (Parameter parameter) const
 Get the value of the specified parameter.
 
template<Parameter P>
internal::ParameterType< P >::ref_type get () const
 Get the value of the specified parameter.
 
std::variant< int, double, Vector > get (Parameter parameter) const
 Get the value of the specified parameter.
 
void set (Parameter parameter, const std::variant< int, double, Vector > &value)
 Set the parameter to the indicated value.
 
template<Parameter P>
void set (const std::variant< int, double, Vector > &value)
 Set the parameter to the indicated value.
 
void set (Parameter parameter, std::size_t idx, const std::variant< std::vector< int >, std::vector< double >, std::vector< Vector > > &values)
 Set the parameter to the index-th value among the indicated values.
 
template<Parameter P>
void set (std::size_t idx, const std::variant< std::vector< int >, std::vector< double >, std::vector< Vector > > &values)
 Set the parameter to the index-th value among the indicated values.
 
virtual void set (Parameter parameter, int value)
 Set the parameter to the indicated value.
 
virtual void set (Parameter parameter, double value)
 Set the parameter to the indicated value.
 
virtual void set (Parameter parameter, const Vector &value)
 Set the parameter to the indicated value.
 
template<Parameter P>
void set (typename internal::ParameterType< P >::ref_type value)
 Set the parameter to the indicated value.
 
bool has (const Parameter parameter) const
 Check whether the parameter is present in this object.
 
Parameters parameters () const
 Get read-only access to the parameters of the parametrizable object.
 
std::vector< Parameterparameters_list () const
 Get read-only access to the list of parameters of the parametrizable object.
 
Parametrizableload (const Parametrizable &o)
 Load parameters from another Parametrizable object.
 

Protected Attributes

double objective_value_
 Objective value of the optimisation problem.
 
Vector gradient_
 Gradient of the objective function.
 
- Protected Attributes inherited from lucid::Parametrizable
Parameters parameters_
 Parameters supported by this object.
 

Additional Inherited Members

- Protected Member Functions inherited from lucid::Estimator
virtual Estimatorconsolidate_impl (ConstMatrixRef training_inputs, ConstMatrixRef training_outputs, Requests requests)=0
 Concrete implementation of the consolidate method.
 
- Protected Member Functions inherited from lucid::Parametrizable
virtual int get_i (Parameter parameter) const
 Get the value of the specified parameter.
 
virtual double get_d (Parameter parameter) const
 Get the value of the specified parameter.
 
virtual const Vector & get_v (Parameter parameter) const
 Get the value of the specified parameter.
 

Detailed Description

Interface for objects that can be optimised using gradient-based methods (e.g., LbfgsTuner).

It provides access to the objective value and the gradient of the objective function needed for optimisation.

Todo
Instead of being a subclass of Estimator, we should introduce a mixin subclass that supports oll kinds of mixins

Member Function Documentation

◆ gradient()

const Vector & lucid::GradientOptimizable::gradient ( ) const
inlinenodiscard

Get read-only access to the gradient of the this object.

If it has not been computed, it will be a vector of size 0.

Returns
gradient of the this object

◆ objective_value()

double lucid::GradientOptimizable::objective_value ( ) const
inlinenodiscard

Get read-only access to the objective value of the this object.

If it has not been computed, it will be \( -\infty \).

Returns
objective value of the this object

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