Utilities Functions
This class contains functions used to perform file i/o operations as well as post-processing of model results.
-
class Utilities
Public Functions
-
inline Utilities()
Default constructor for utilities.
Constructor for utilities class.
-
inline ~Utilities()
Destructor for utilities class.
-
void train_test_split(const vector<vector<double>> &features, const vector<vector<double>> &outputs, TrainTestData &train_test)
Split the input data for features and outputs into training and test sets.
-
TrainTestData get_train_test_data(nlohmann::json model_parameters)
Read data from input file and split it into training and test sets.
-
nlohmann::json_abi_v3_11_3::json read_json(std::string inputFileName)
Read input parameters from a file in JSON format.
-
void read_data_csv(std::string data_file, int number_features, int number_outputs, std::vector<std::vector<double>> &features, std::vector<std::vector<double>> &outputs, char delimiter = ',')
Read data for features and outputs from a user-specified csv file The first line of the file must begin with two integers specifying the number of columns containing features and outputs respectively.
- Parameters:
data_file – Absolute path to data file.
features – Array to store data for features.
outputs – Array to store data for outputs.
-
void read_data_bin(std::string data_file, int number_features, int number_outputs, std::vector<std::vector<double>> &features, std::vector<std::vector<double>> &outputs, bool distributed = true)
Read data for features and outputs from a binary file The first line of the file must begin with two integers specifying the number of columns containing features and outputs respectively.
- Parameters:
data_file – Absolute path to data file.
features – Array to store data for features.
outputs – Array to store data for outputs.
Public Members
-
double train_ratio = 0.75
Proportion of input data to be used for training.
-
bool shuffle_data = true
Whether the data should be randomly shuffled before splitting into train and test sets.
-
int random_seed = 1
random seed for shuffling data
-
shared_ptr<Logger> logger
Pointer to a Logger instance.
-
inline Utilities()