FlexNN 1
Fully connected neural network built from scratch with flexible n-layer design and multiple activations.
Loading...
Searching...
No Matches
Utility.h
Go to the documentation of this file.
1
10#ifndef FlexNN_UTILITY_H
11#define FlexNN_UTILITY_H
12
13#include <cstdint>
14#include <string>
15#include <vector>
16
17#include <Eigen/Dense>
18
19namespace FlexNN {
20
28Eigen::MatrixXd oneHotEncode(const Eigen::VectorXd &Y, int num_classes);
29
37void readCSV_XY(const std::string &filename, Eigen::MatrixXd &X, Eigen::VectorXd &Y);
38
48void setRandomSeed(uint32_t seed);
49
55uint32_t getRandomSeed() noexcept;
56
70std::vector<std::pair<Eigen::MatrixXd, Eigen::VectorXd>> splitXY(
71 const Eigen::MatrixXd &X, const Eigen::VectorXd &Y,
72 const std::vector<double> &proportions);
73
86std::vector<std::pair<Eigen::MatrixXd, Eigen::VectorXd>> splitXY(
87 const Eigen::MatrixXd &X, const Eigen::VectorXd &Y,
88 const std::vector<double> &proportions, uint32_t seed);
89
90} // namespace FlexNN
91
92#endif // FlexNN_UTILITY_H
Namespace for the FlexNN neural network library.
Definition Activation.hpp:31
std::vector< std::pair< Eigen::MatrixXd, Eigen::VectorXd > > splitXY(const Eigen::MatrixXd &X, const Eigen::VectorXd &Y, const std::vector< double > &proportions)
Splits dataset into multiple sets by proportions (uses global seed).
Definition Utility.cpp:85
void setRandomSeed(uint32_t seed)
Set the global RNG seed for splitXY (deterministic splits).
Definition Utility.cpp:37
Eigen::MatrixXd oneHotEncode(const Eigen::VectorXd &Y, int num_classes)
One-hot encodes a vector of class labels.
Definition Utility.cpp:44
uint32_t getRandomSeed() noexcept
Get the current global RNG seed.
Definition Utility.cpp:42
void readCSV_XY(const std::string &filename, Eigen::MatrixXd &X, Eigen::VectorXd &Y)
Reads a CSV where first column is label, rest are features.
Definition Utility.cpp:53