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

Namespace for the FlexNN neural network library. More...

Classes

class  Layer
 Represents a single layer in a neural network. More...
 
class  NeuralNetwork
 Class representing a neural network. More...
 

Functions

Eigen::MatrixXd oneHotEncode (const Eigen::VectorXd &Y, int num_classes)
 One-hot encodes a vector of class labels.
 
void readCSV_XY (const std::string &filename, Eigen::MatrixXd &X, Eigen::VectorXd &Y)
 Reads a CSV file and splits it into features (X) and labels (Y).
 
std::vector< std::pair< Eigen::MatrixXd, Eigen::VectorXd > > splitXY (const Eigen::MatrixXd &X, const Eigen::VectorXd &Y, const std::vector< double > &proportions)
 Splits the dataset into multiple sets based on specified proportions.
 

Detailed Description

Namespace for the FlexNN neural network library.

This namespace contains all the classes and functions related to the FlexNN library, including the NeuralNetwork class and Layer class. It provides a structured way to organize the library's components and avoid naming conflicts with other libraries.

Function Documentation

◆ oneHotEncode()

Eigen::MatrixXd FlexNN::oneHotEncode ( const Eigen::VectorXd &  Y,
int  num_classes 
)

One-hot encodes a vector of class labels.

This function takes a vector of class labels and converts it into a one-hot encoded matrix. Each row corresponds to a class label, and each column corresponds to a class.

Parameters
YThe input vector of class labels.
num_classesThe number of unique classes.
Returns
An Eigen::MatrixXd where each row is a one-hot encoded vector for the corresponding class label.

◆ readCSV_XY()

void FlexNN::readCSV_XY ( const std::string &  filename,
Eigen::MatrixXd &  X,
Eigen::VectorXd &  Y 
)

Reads a CSV file and splits it into features (X) and labels (Y).

This function reads a CSV file where the first column is considered the label (Y) and the remaining columns are considered features (X). It populates the provided Eigen matrices with the data from the CSV file.

Parameters
filenameThe path to the CSV file to read.
XThe Eigen::MatrixXd to store the features (all columns except the first).
YThe Eigen::VectorXd to store the labels (the first column).

◆ splitXY()

std::vector< std::pair< Eigen::MatrixXd, Eigen::VectorXd > > FlexNN::splitXY ( const Eigen::MatrixXd &  X,
const Eigen::VectorXd &  Y,
const std::vector< double > &  proportions 
)

Splits the dataset into multiple sets based on specified proportions.

This function takes a dataset represented by features (X) and labels (Y), and splits it into multiple sets according to the provided proportions.

Parameters
XThe input feature matrix (Eigen::MatrixXd).
YThe input label vector (Eigen::VectorXd).
proportionsA vector of doubles representing the proportions for each split.
Returns
A vector of pairs, where each pair contains a feature matrix and a label vector for each split.