AlgoPlus v0.1.0
Loading...
Searching...
No Matches
MLP Class Reference

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>

Public Member Functions

 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
 

Detailed Description

Multilayer Perceptron class. Performs binary and categorical classification Uses nn::Linear as a sequential model, follows PyTorch's implementation. TODO: Addition of Conv1d layers.

Constructor & Destructor Documentation

◆ 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
data2D vector, The input data. As usual, the last element of each sub-vector represents the label of the row
arch1D 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

Member Function Documentation

◆ predict()

double MLP::predict ( std::vector< double > const & input)
inline

performs inference

Parameters
input1D vector, the passed validation data
Returns
double: The classified label

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