FlexNN 1
Fully connected neural network built from scratch with flexible n-layer design and multiple activations.
Loading...
Searching...
No Matches
FlexNN::NeuralNetwork Class Reference

Class representing a neural network. More...

#include <FlexNN.h>

Public Member Functions

 NeuralNetwork (const std::vector< Layer > &layers)
 Constructor for the NeuralNetwork class.
 
void train (const Eigen::MatrixXd &input, const Eigen::MatrixXd &target, double learningRate, int epochs)
 Train the neural network.
 
double accuracy (const Eigen::MatrixXd &X, const Eigen::MatrixXd &Y)
 Calculate the accuracy of the neural network.
 
Eigen::MatrixXd predict (const Eigen::MatrixXd &input)
 Predict the output for given input data.
 

Detailed Description

Class representing a neural network.

This class encapsulates the functionality of a neural network, including training, prediction, and accuracy calculation. It uses a vector of Layer objects to represent the structure of the network.

Constructor & Destructor Documentation

◆ NeuralNetwork()

FlexNN::NeuralNetwork::NeuralNetwork ( const std::vector< Layer > &  layers)
inline

Constructor for the NeuralNetwork class.

Parameters
layersA vector of Layer objects representing the layers of the neural network.

Member Function Documentation

◆ accuracy()

double FlexNN::NeuralNetwork::accuracy ( const Eigen::MatrixXd &  X,
const Eigen::MatrixXd &  Y 
)

Calculate the accuracy of the neural network.

This method computes the accuracy of the neural network's predictions against the target data.

Parameters
XThe input data for prediction.
YThe target output data for comparison.
Returns
The accuracy as a double value.

◆ predict()

Eigen::MatrixXd FlexNN::NeuralNetwork::predict ( const Eigen::MatrixXd &  input)
inline

Predict the output for given input data.

This method performs a forward pass through the neural network to predict the output for the provided input data.

Parameters
inputThe input data for prediction.
Returns
The predicted output as an Eigen::MatrixXd.

◆ train()

void FlexNN::NeuralNetwork::train ( const Eigen::MatrixXd &  input,
const Eigen::MatrixXd &  target,
double  learningRate,
int  epochs 
)

Train the neural network.

This method trains the neural network using the provided input and target data. It performs forward and backward passes, updating weights based on the gradients.

Parameters
inputThe input data for training.
targetThe target output data for training.
learningRateThe learning rate for weight updates.
epochsThe number of training epochs.

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