OpenNN
Open-source neural networks library
Loading...
Searching...
No Matches
opennn::BackPropagationLM Struct Reference

Scratch state used by LevenbergMarquardtAlgorithm. More...

#include <levenberg_marquardt_algorithm.h>

Public Member Functions

 BackPropagationLM (const Index samples_number=0, Loss *loss=nullptr)
 Constructs the scratch state.
 
virtual ~BackPropagationLM ()=default
 Virtual destructor.
 
void set (const Index samples_number=0, Loss *loss=nullptr)
 (Re)allocates buffers for the given dataset.
 

Public Attributes

Index samples_number = 0
 Number of samples this scratch is sized for.
 
VectorR output_deltas
 Per-sample output deltas.
 
Shape output_delta_dimensions
 Shape of output_deltas as a multi-dimensional view.
 
Lossloss = nullptr
 Loss to which this scratch is bound; not owned.
 
float error
 Mean error over the batch.
 
float regularization = 0.0f
 Regularization contribution to the loss.
 
float loss_value = 0.0f
 Total loss = error + regularization.
 
VectorR errors
 Per-sample residual errors.
 
VectorR squared_errors
 Per-sample squared errors.
 
MatrixR squared_errors_jacobian
 Jacobian of squared_errors with respect to the parameters.
 
VectorR gradient
 Approximate gradient (J^T * e).
 
MatrixR hessian
 Approximate Hessian (J^T * J + lambda * I).
 

Detailed Description

Scratch state used by LevenbergMarquardtAlgorithm.

Holds per-sample errors and squared errors, the Jacobian of the squared errors with respect to parameters, and the resulting approximate gradient and Hessian used by the LM update.

Constructor & Destructor Documentation

◆ BackPropagationLM()

opennn::BackPropagationLM::BackPropagationLM ( const Index samples_number = 0,
Loss * loss = nullptr )

Constructs the scratch state.

Parameters
samples_numberNumber of samples that will be processed.
lossLoss to which the state is bound.

◆ ~BackPropagationLM()

virtual opennn::BackPropagationLM::~BackPropagationLM ( )
virtualdefault

Virtual destructor.

Member Function Documentation

◆ set()

void opennn::BackPropagationLM::set ( const Index samples_number = 0,
Loss * loss = nullptr )

(Re)allocates buffers for the given dataset.

Parameters
samples_numberNumber of samples to allocate for.
lossLoss to bind.

Member Data Documentation

◆ error

float opennn::BackPropagationLM::error

Mean error over the batch.

◆ errors

VectorR opennn::BackPropagationLM::errors

Per-sample residual errors.

◆ gradient

VectorR opennn::BackPropagationLM::gradient

Approximate gradient (J^T * e).

◆ hessian

MatrixR opennn::BackPropagationLM::hessian

Approximate Hessian (J^T * J + lambda * I).

◆ loss

Loss* opennn::BackPropagationLM::loss = nullptr

Loss to which this scratch is bound; not owned.

◆ loss_value

float opennn::BackPropagationLM::loss_value = 0.0f

Total loss = error + regularization.

◆ output_delta_dimensions

Shape opennn::BackPropagationLM::output_delta_dimensions

Shape of output_deltas as a multi-dimensional view.

◆ output_deltas

VectorR opennn::BackPropagationLM::output_deltas

Per-sample output deltas.

◆ regularization

float opennn::BackPropagationLM::regularization = 0.0f

Regularization contribution to the loss.

◆ samples_number

Index opennn::BackPropagationLM::samples_number = 0

Number of samples this scratch is sized for.

◆ squared_errors

VectorR opennn::BackPropagationLM::squared_errors

Per-sample squared errors.

◆ squared_errors_jacobian

MatrixR opennn::BackPropagationLM::squared_errors_jacobian

Jacobian of squared_errors with respect to the parameters.