NetDEM v1.0
Loading...
Searching...
No Matches
regression_net.hpp
Go to the documentation of this file.
1#pragma once
2
3// netdem
4#include "mlpack_utils.hpp"
5
6// std
7#include <cstdarg>
8#include <string>
9
10namespace netdem {
11
22public:
24 mlpack::FFN<mlpack::MeanSquaredError, mlpack::HeInitialization> model;
25
27 double step_size{0.01};
28
30 int batch_size{32};
31
33 double decay_rate_moment{0.9};
34
36 double decay_rate_norm{0.9};
37
39 double gradient_init_param{1e-8};
40
42 int epochs{100};
43
45 double stop_tol{1e-8};
46
48 bool enable_logging{true};
49
55 void ResetModel();
56
68 void AddLayer(MLPackUtils::LayerType layer_name, ...);
69
80 void Train(const arma::mat &data_x, const arma::mat &data_y);
81
92 arma::mat Predict(const arma::mat &data_x);
93
105 arma::mat Gradient(const arma::mat &data_x);
106
115 void Load(std::string const &filename, std::string const &label);
116
125 void Save(std::string const &filename, std::string const &label);
126};
127
128} // namespace netdem
LayerType
An enumeration of neural network layer types.
Definition mlpack_utils.hpp:19
A class that represents a feedforward neural network for regression.
Definition regression_net.hpp:21
double gradient_init_param
Initial parameter value used for weight initialization during training.
Definition regression_net.hpp:39
int epochs
The number of epochs used for training.
Definition regression_net.hpp:42
double stop_tol
The stopping tolerance used for determining when to stop training.
Definition regression_net.hpp:45
arma::mat Gradient(const arma::mat &data_x)
Calculates the gradient of the neural network model with respect to input data.
Definition regression_net.cpp:68
void Save(std::string const &filename, std::string const &label)
Saves the neural network model to disk.
Definition regression_net.cpp:99
int batch_size
The batch size used for mini-batch gradient descent during training.
Definition regression_net.hpp:30
mlpack::FFN< mlpack::MeanSquaredError, mlpack::HeInitialization > model
The model object that represents the neural network.
Definition regression_net.hpp:24
void Load(std::string const &filename, std::string const &label)
Loads the neural network model from disk.
Definition regression_net.cpp:95
void ResetModel()
Resets the neural network model.
Definition regression_net.cpp:10
double step_size
The step size used for optimization during training.
Definition regression_net.hpp:27
double decay_rate_norm
The decay rate used for weight normalization during training.
Definition regression_net.hpp:36
void AddLayer(MLPackUtils::LayerType layer_name,...)
Adds a layer to the neural network model.
Definition regression_net.cpp:15
void Train(const arma::mat &data_x, const arma::mat &data_y)
Trains the neural network model with data.
Definition regression_net.cpp:51
double decay_rate_moment
The decay rate used for momentum during training.
Definition regression_net.hpp:33
arma::mat Predict(const arma::mat &data_x)
Predicts with the neural network model using input data.
Definition regression_net.cpp:62
bool enable_logging
Whether or not to enable logging during training.
Definition regression_net.hpp:48
Definition bond_entry.hpp:7