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

A class representing a general neural network. More...

#include <general_net.hpp>

Public Member Functions

void ResetModel ()
 Resets the current neural network model.
 
void AddLayer (MLPackUtils::LayerType layer_name,...)
 Adds a layer to the current neural network model.
 
void Train (const arma::mat &data_x, const arma::mat &data_y)
 Trains the current neural network model using the given input and output data.
 
arma::mat Predict (const arma::mat &data_x)
 Predicts output values based on input data.
 
arma::mat Classify (const arma::mat &data_x)
 Classifies input data based on the current neural network model.
 
arma::mat Regress (const arma::mat &data_x)
 Performs regression on input data using the current neural network model.
 
void Load (std::string const &filename, std::string const &label)
 Loads a previously saved neural network model from a file.
 
void Save (std::string const &filename, std::string const &label)
 Saves the current neural network model to a file.
 

Public Attributes

mlpack::FFN model
 The ANN model.
 
double step_size {0.01}
 Machine learning hyper-parameters.
 
int batch_size {32}
 Machine learning hyper-parameters.
 
double decay_rate_moment {0.9}
 Machine learning hyper-parameters.
 
double decay_rate_norm {0.9}
 Machine learning hyper-parameters.
 
double gradient_init_param {1e-8}
 Machine learning hyper-parameters.
 
int epochs {100}
 Machine learning hyper-parameters.
 
double stop_tol {1e-8}
 Machine learning hyper-parameters.
 
bool enable_logging {true}
 A flag indicating whether to log info.
 

Detailed Description

Member Function Documentation

◆ AddLayer()

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

Adds a layer to the current neural network model.

Parameters
layer_nameThe type of layer to add.
...Additional parameters required for the layer to be added.

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

Examples
02_train_classifier_trimesh_plane.cpp, 12_train_classifier_trimesh.cpp, 22_train_classifier_ellipsoid_plane.cpp, and 32_train_classifier_ellipsoid.cpp.

◆ Classify()

◆ Load()

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

◆ Predict()

arma::mat netdem::GeneralNet::Predict ( const arma::mat & data_x)

Predicts output values based on input data.

Parameters
data_xThe input data to use for prediction.
Returns
The predicted output values.

◆ Regress()

arma::mat netdem::GeneralNet::Regress ( const arma::mat & data_x)

Performs regression on input data using the current neural network model.

Parameters
data_xThe input data to use for regression.
Returns
The regression results.

◆ ResetModel()

void netdem::GeneralNet::ResetModel ( )

Resets the current neural network model.

◆ Save()

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

Saves the current neural network model to a file.

Parameters
filenameThe name of the file to save the model to.
labelThe label for the saved model.
Examples
02_train_classifier_trimesh_plane.cpp, 12_train_classifier_trimesh.cpp, 22_train_classifier_ellipsoid_plane.cpp, and 32_train_classifier_ellipsoid.cpp.

◆ Train()

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

Trains the current neural network model using the given input and output data.

Parameters
data_xThe input data to use for training.
data_yThe output data to use for training.
Examples
02_train_classifier_trimesh_plane.cpp, 12_train_classifier_trimesh.cpp, 22_train_classifier_ellipsoid_plane.cpp, and 32_train_classifier_ellipsoid.cpp.

Member Data Documentation

◆ batch_size

int netdem::GeneralNet::batch_size {32}

◆ decay_rate_moment

double netdem::GeneralNet::decay_rate_moment {0.9}

Machine learning hyper-parameters.

Examples
32_train_classifier_ellipsoid.cpp.

◆ decay_rate_norm

double netdem::GeneralNet::decay_rate_norm {0.9}

Machine learning hyper-parameters.

Examples
32_train_classifier_ellipsoid.cpp.

◆ enable_logging

bool netdem::GeneralNet::enable_logging {true}

A flag indicating whether to log info.

◆ epochs

◆ gradient_init_param

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

Machine learning hyper-parameters.

◆ model

mlpack::FFN netdem::GeneralNet::model

The ANN model.

◆ step_size

double netdem::GeneralNet::step_size {0.01}

◆ stop_tol

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

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