Multilayer Perceptron class. Performs binary and categorical classification Uses nn::Linear as a sequential model, follows PyTorch's implementation. TODO: Addition of Conv1d layers.
More...
#include <mlp.h>
|
| MLP (std::vector< std::vector< double > > const &, std::vector< std::pair< int, int > > const, const int epochs=100, const double learning_rate=0.001) |
| default constructor for MLP class
|
|
void | fit () |
| fit an MLP on the input data
|
|
double | predict (std::vector< double > const &) |
| performs inference
|
|
Multilayer Perceptron class. Performs binary and categorical classification Uses nn::Linear as a sequential model, follows PyTorch's implementation. TODO: Addition of Conv1d layers.
◆ MLP()
MLP::MLP |
( |
std::vector< std::vector< double > > const & | data, |
|
|
std::vector< std::pair< int, int > > const | arch, |
|
|
const int | epochs = 100, |
|
|
const double | learning_rate = 0.001 ) |
|
inlineexplicit |
default constructor for MLP class
- Parameters
-
data | 2D vector, The input data. As usual, the last element of each sub-vector represents the label of the row |
arch | 1D vector of pairs. Represents the [in_features, out_features] of each layer in the network |
epochs(int) | The number of epochs |
learning_rate(double) | The learning rate |
◆ predict()
double MLP::predict |
( |
std::vector< double > const & | input | ) |
|
|
inline |
performs inference
- Parameters
-
input | 1D vector, the passed validation data |
- Returns
- double: The classified label
The documentation for this class was generated from the following file:
- /Users/runner/work/AlgoPlus/AlgoPlus/src/machine_learning/nn/mlp.h