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

Utility functions for FlexNN — CSV, one-hot, and deterministic splits. More...

#include <cstdint>
#include <string>
#include <vector>
#include <Eigen/Dense>
Include dependency graph for Utility.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  FlexNN
 Namespace for the FlexNN neural network library.
 

Functions

Eigen::MatrixXd FlexNN::oneHotEncode (const Eigen::VectorXd &Y, int num_classes)
 One-hot encodes a vector of class labels.
 
void FlexNN::readCSV_XY (const std::string &filename, Eigen::MatrixXd &X, Eigen::VectorXd &Y)
 Reads a CSV where first column is label, rest are features.
 
void FlexNN::setRandomSeed (uint32_t seed)
 Set the global RNG seed for splitXY (deterministic splits).
 
uint32_t FlexNN::getRandomSeed () noexcept
 Get the current global RNG seed.
 
std::vector< std::pair< Eigen::MatrixXd, Eigen::VectorXd > > FlexNN::splitXY (const Eigen::MatrixXd &X, const Eigen::VectorXd &Y, const std::vector< double > &proportions)
 Splits dataset into multiple sets by proportions (uses global seed).
 
std::vector< std::pair< Eigen::MatrixXd, Eigen::VectorXd > > FlexNN::splitXY (const Eigen::MatrixXd &X, const Eigen::VectorXd &Y, const std::vector< double > &proportions, uint32_t seed)
 Splits dataset with explicit seed (deterministic, no global state).
 

Detailed Description

Utility functions for FlexNN — CSV, one-hot, and deterministic splits.

Adds setRandomSeed/getRandomSeed so splitXY is deterministic when a seed is set, while keeping the old splitXY(X,Y,props) signature for backward compat (uses the global seed). See LLD_FLEXNN §8.