FlexNN 1
Fully connected neural network built from scratch with flexible n-layer design and multiple activations.
|
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. | |
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.
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.
Y | The input vector of class labels. |
num_classes | The number of unique classes. |
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.
filename | The path to the CSV file to read. |
X | The Eigen::MatrixXd to store the features (all columns except the first). |
Y | The Eigen::VectorXd to store the labels (the first column). |
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.
X | The input feature matrix (Eigen::MatrixXd). |
Y | The input label vector (Eigen::VectorXd). |
proportions | A vector of doubles representing the proportions for each split. |