NetDEM v1.0
Loading...
Searching...
No Matches
netdem::RegressionNet Class Reference

A class that represents a feedforward neural network for regression. More...

#include <regression_net.hpp>

Public Member Functions

void ResetModel ()
 Resets the neural network model.
 
void AddLayer (MLPackUtils::LayerType layer_name,...)
 Adds a layer to the neural network model.
 
void Train (const arma::mat &data_x, const arma::mat &data_y)
 Trains the neural network model with data.
 
arma::mat Predict (const arma::mat &data_x)
 Predicts with the neural network model using input data.
 
arma::mat Gradient (const arma::mat &data_x)
 Calculates the gradient of the neural network model with respect to input data.
 
void Load (std::string const &filename, std::string const &label)
 Loads the neural network model from disk.
 
void Save (std::string const &filename, std::string const &label)
 Saves the neural network model to disk.
 

Public Attributes

mlpack::FFN< mlpack::MeanSquaredError, mlpack::HeInitialization > model
 The model object that represents the neural network.
 
double step_size {0.01}
 The step size used for optimization during training.
 
int batch_size {32}
 The batch size used for mini-batch gradient descent during training.
 
double decay_rate_moment {0.9}
 The decay rate used for momentum during training.
 
double decay_rate_norm {0.9}
 The decay rate used for weight normalization during training.
 
double gradient_init_param {1e-8}
 Initial parameter value used for weight initialization during training.
 
int epochs {100}
 The number of epochs used for training.
 
double stop_tol {1e-8}
 The stopping tolerance used for determining when to stop training.
 
bool enable_logging {true}
 Whether or not to enable logging during training.
 

Detailed Description

Member Function Documentation

◆ AddLayer()

void netdem::RegressionNet::AddLayer ( MLPackUtils::LayerType layer_name,
... )

Adds a layer to the neural network model.

This function adds a layer to the neural network model.

Parameters
layer_nameThe type of layer to add.
...Additional arguments depending on the type of layer being added.

For MLPackUtils::LayerType::Linear, an additional parameter indicating the dimension of outputs is required.

Examples
01_train_netsdf.cpp, 03_train_netspf.cpp, 04_train_regressor_trimesh_plane.cpp, 11_train_coded_netsdf.cpp, 14_train_regressor_trimesh.cpp, 24_train_regressor_ellipsoid_plane.cpp, and 34_train_regressor_ellipsoid.cpp.

◆ Gradient()

arma::mat netdem::RegressionNet::Gradient ( const arma::mat & data_x)

Calculates the gradient of the neural network model with respect to input data.

This function calculates the gradient of the neural network model with respect to the input data using backpropagation.

Parameters
data_xThe input data matrix.
Returns
The gradient of the neural network model with respect to the input data as a matrix of size (input_dim x num_samples).
Examples
11_train_coded_netsdf.cpp, and 16_test_latent_space.cpp.

◆ Load()

void netdem::RegressionNet::Load ( std::string const & filename,
std::string const & label )

◆ Predict()

◆ ResetModel()

void netdem::RegressionNet::ResetModel ( )

Resets the neural network model.

This function resets the neural network model.

◆ Save()

void netdem::RegressionNet::Save ( std::string const & filename,
std::string const & label )

Saves the neural network model to disk.

This function saves the neural network model to disk.

Parameters
filenameThe name of the file to save the model data to.
labelThe label of the model data within the file (if applicable).
Examples
01_train_netsdf.cpp, 03_train_netspf.cpp, 04_train_regressor_trimesh_plane.cpp, 11_train_coded_netsdf.cpp, 14_train_regressor_trimesh.cpp, 24_train_regressor_ellipsoid_plane.cpp, and 34_train_regressor_ellipsoid.cpp.

◆ Train()

void netdem::RegressionNet::Train ( const arma::mat & data_x,
const arma::mat & data_y )

Trains the neural network model with data.

This function trains the neural network model with the provided input and output data using mini-batch gradient descent with momentum and weight normalization.

Parameters
data_xThe input data matrix.
data_yThe output data matrix.
Examples
01_train_netsdf.cpp, 03_train_netspf.cpp, 04_train_regressor_trimesh_plane.cpp, 11_train_coded_netsdf.cpp, 14_train_regressor_trimesh.cpp, 24_train_regressor_ellipsoid_plane.cpp, and 34_train_regressor_ellipsoid.cpp.

Member Data Documentation

◆ batch_size

int netdem::RegressionNet::batch_size {32}

◆ decay_rate_moment

double netdem::RegressionNet::decay_rate_moment {0.9}

The decay rate used for momentum during training.

Examples
34_train_regressor_ellipsoid.cpp.

◆ decay_rate_norm

double netdem::RegressionNet::decay_rate_norm {0.9}

The decay rate used for weight normalization during training.

Examples
34_train_regressor_ellipsoid.cpp.

◆ enable_logging

bool netdem::RegressionNet::enable_logging {true}

Whether or not to enable logging during training.

Examples
01_train_netsdf.cpp, 03_train_netspf.cpp, and 11_train_coded_netsdf.cpp.

◆ epochs

◆ gradient_init_param

double netdem::RegressionNet::gradient_init_param {1e-8}

Initial parameter value used for weight initialization during training.

◆ model

mlpack::FFN<mlpack::MeanSquaredError, mlpack::HeInitialization> netdem::RegressionNet::model

The model object that represents the neural network.

◆ step_size

◆ stop_tol

double netdem::RegressionNet::stop_tol {1e-8}

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