|
|
lucid
0.0.1
Lifting-based Uncertain Control Invariant Dynamics
|
Given two vector spaces, \( \texttip{\mathcal{X}}{Polish sample vector space} \subseteq \mathbb{R}^{d_x} \) and \( \texttip{\mathcal{Y}}{Polish sample vector space} \subseteq \mathbb{R}^{d_y} \), and a map \( f: \mathcal{X} \to \mathcal{Y} \), the Estimator's goal is to produce a model \( f^*:\mathcal{X} \to \mathcal{Y} \) that best approximates \( f \). More...
#include <Estimator.h>
Public Member Functions | |
| 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} \). | |
| Estimator & | fit (ConstMatrixRef training_inputs, ConstMatrixRef training_outputs, const Tuner &tuner) |
| Fit the model to the given data. | |
| Estimator & | fit (ConstMatrixRef training_inputs, ConstMatrixRef training_outputs) |
| Fit the model to the given data. | |
| Estimator & | fit_online (ConstMatrixRef training_inputs, const OutputComputer &training_outputs, const Tuner &tuner) |
Fit the model to the data produced by the training_outputs OutputComputer. | |
| Estimator & | fit_online (ConstMatrixRef training_inputs, const OutputComputer &training_outputs) |
Fit the model to the data produced by the training_outputs OutputComputer. | |
| Estimator & | consolidate (ConstMatrixRef training_inputs, ConstMatrixRef training_outputs, const Request request=Request::_) |
| Consolidate the model, making sure it is ready for use. | |
| Estimator & | consolidate (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< Estimator > | clone () 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> | |
| 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< Parameter > | parameters_list () const |
| Get read-only access to the list of parameters of the parametrizable object. | |
| Parametrizable & | load (const Parametrizable &o) |
Load parameters from another Parametrizable object. | |
Protected Member Functions | |
| virtual Estimator & | consolidate_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. | |
Private Attributes | |
| std::shared_ptr< const Tuner > | tuner_ |
| Tuner used during fitting if no other turner is provided. If null, no tuning is performed. | |
Additional Inherited Members | |
Protected Attributes inherited from lucid::Parametrizable | |
| Parameters | parameters_ |
| Parameters supported by this object. | |
Given two vector spaces, \( \texttip{\mathcal{X}}{Polish sample vector space} \subseteq \mathbb{R}^{d_x} \) and \( \texttip{\mathcal{Y}}{Polish sample vector space} \subseteq \mathbb{R}^{d_y} \), and a map \( f: \mathcal{X} \to \mathcal{Y} \), the Estimator's goal is to produce a model \( f^*:\mathcal{X} \to \mathcal{Y} \) that best approximates \( f \).
|
explicit |
Construct a new Estimator object.
If no tuner is provided, the estimator will not use any during the fitting process, keeping the hyperparameters it was initialised with.
| parameters | parameters of the estimator, default to no specific parameter |
| tuner | Tuner object used to find the best hyperparameters for the model. If none has been provided, the estimator will not use any tuner during the fitting process, keeping the hyperparameters it was initialised with. |
|
nodiscardpure virtual |
Clone the estimator by creating a new instance with the same parameters.
Implemented in lucid::KernelRidgeRegressor, and lucid::ModelEstimator.
|
inline |
Consolidate the model, making sure it is ready for use.
No fitting process is performed, and the hyperparameters are not updated, but the estimator may change its internal state so it can be used for predictions. After the process is completed, the estimator can be used to make predictions on new data. The request parameter is used to specify an additional option for the consolidation process, like whether to compute some additional values used by some tuners.
| training_inputs | training input data. The number of rows should be equal to the number of training outputs |
| training_outputs | training output data. The number of rows should be equal to the number of training inputs |
| request | request for the consolidation process. Defaults to no specific request being made |
| Estimator & lucid::Estimator::consolidate | ( | ConstMatrixRef | training_inputs, |
| ConstMatrixRef | training_outputs, | ||
| Requests | requests ) |
Consolidate the model, making sure it is ready for use.
No fitting process is performed, and the hyperparameters are not updated, but the estimator may change its internal state so it can be used for predictions. After the process is completed, the estimator can be used to make predictions on new data. The requests parameter can be used to specify additional options for the consolidation process, like whether to compute some additional values used by some tuners.
| training_inputs | training input data |
| training_outputs | training output data |
| requests | requests for the consolidation process |
|
protectedpure virtual |
Concrete implementation of the consolidate method.
| training_inputs | training input data |
| training_outputs | training output data |
| requests | requests for the consolidation process |
Implemented in lucid::KernelRidgeRegressor, and lucid::ModelEstimator.
| Estimator & lucid::Estimator::fit | ( | ConstMatrixRef | training_inputs, |
| ConstMatrixRef | training_outputs ) |
Fit the model to the given data.
This method will use the object's tuner to find the best hyperparameters for the model. After the process is completed, the estimator can be used to make predictions on new data. If no tuner has been provided during construction, the method is equivalent to consolidate with no specific request.
| training_inputs | training input data |
| training_outputs | training output data |
| Estimator & lucid::Estimator::fit | ( | ConstMatrixRef | training_inputs, |
| ConstMatrixRef | training_outputs, | ||
| const Tuner & | tuner ) |
Fit the model to the given data.
This method will use the provided tuner to find the best hyperparameters for the model. After the process is completed, the estimator can be used to make predictions on new data.
| training_inputs | training input data |
| training_outputs | training output data |
| tuner | Tuner object used to find the best hyperparameters for the model |
| Estimator & lucid::Estimator::fit_online | ( | ConstMatrixRef | training_inputs, |
| const OutputComputer & | training_outputs ) |
Fit the model to the data produced by the training_outputs OutputComputer.
This method will use the object's tuner to find the best hyperparameters for the model. After the process is completed, the estimator can be used to make predictions on new data. If no tuner has been provided during construction, the method is equivalent to consolidate with no specific request.
| training_inputs | training input data |
| training_outputs | training output data. It uses an OutputComputer to compute the outputs when needed |
| Estimator & lucid::Estimator::fit_online | ( | ConstMatrixRef | training_inputs, |
| const OutputComputer & | training_outputs, | ||
| const Tuner & | tuner ) |
Fit the model to the data produced by the training_outputs OutputComputer.
This method will use the provided tuner to find the best hyperparameters for the model. After the process is completed, the estimator can be used to make predictions on new data.
| training_inputs | training input data |
| training_outputs | training output data. It uses an OutputComputer to compute the outputs when needed |
| tuner | Tuner object used to find the best hyperparameters for the model |
|
inline |
Get read-write access to the tuner of the estimator.
Can be null
|
nodiscard |
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} \).
| x | \( n \times d_x \) matrix of row vectors in \( \mathcal{X} \) |
|
nodiscardpure virtual |
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} \).
| x | \( n \times d_x \) matrix of row vectors in \( \mathcal{X} \) |
Implemented in lucid::KernelRidgeRegressor, and lucid::ModelEstimator.
|
nodiscardpure virtual |
Score the estimator assigning a numerical value to its accuracy in predicting the evaluation_outputs given the evaluation_inputs.
Given the evaluation inputs \( x = \{ x_1, \dots, x_n \} \), where \( x_i \in \mathcal{X} \subseteq \mathbb{R}^{d_x}, 0 \le i \le n \), we want to give a numerical score to the model's predictions \( \hat{y} = \{ \hat{y}_1, \dots, \hat{y}_n \} \) with respect to the true outputs \( y = \{ y_1, \dots, y_n \} \), where \( y_i \in \mathcal{Y} \subseteq \mathbb{R}^{d_y}, 0 \le i \le n \).
| evaluation_inputs | \( \texttip{n}{Number of samples} \times \texttip{d_x}{Dimension of the input vector space} \) evaluation input data |
| evaluation_outputs | \( \texttip{n}{Number of samples} \times \texttip{d_y}{Dimension of the output vector space} \) evaluation output data |
Implemented in lucid::KernelRidgeRegressor, and lucid::ModelEstimator.
|
nodiscardvirtual |
Obtain the string representation of this object.
Reimplemented in lucid::KernelRidgeRegressor, and lucid::ModelEstimator.
|
inlinenodiscard |
Get read-only access to the tuner of the estimator.
Can be null