11#include <nlohmann/json.hpp>
void invariant(bool condition, char const *message)
Runtime assertion that throws on failure.
FeatureSet read_features_from_string(std::string const &content)
Parse a feature-only CSV from an in-memory string.
void write(stats::DataPacket const &data, std::string const &filename)
Write a DataPacket to a CSV file (features followed by label, no header).
stats::DataPacket read_sorted(std::string const &filename)
Read a CSV file and sort rows ascending by the response column.
stats::DataPacket read(std::string const &filename)
Read a CSV file into a DataPacket.
nlohmann::json read_file(std::string const &path, ErrorHandler on_error=invariant)
Read a JSON file and parse its contents.
std::string ensure_extension(std::string const &path)
Ensure a file path ends with the ".json" extension.
void write_file(nlohmann::json const &data, std::string const &path, ErrorHandler on_error=invariant)
Write a JSON object to a file (pretty-printed with indent 2).
void write_file(std::string const &content, std::string const &path, ErrorHandler on_error=invariant)
Write a string to a file.
void check_file_exists(std::string const &path)
Exit with an error if a file does not exist at the given path.
void check_dir_not_exists(std::string const &path)
Exit with an error if a directory already exists at the given path.
void(*)(bool, std::string const &) ErrorHandler
Definition IO.hpp:15
void check_file_not_exists(std::string const &path)
Exit with an error if a file already exists at the given path.
std::vector< std::string > Names
Vector of name strings — used uniformly for class labels (group_names[i] is the label for GroupId == ...
Definition Types.hpp:49
Eigen::Matrix< Feature, Eigen::Dynamic, Eigen::Dynamic > FeatureMatrix
Dynamic-size matrix of feature values.
Definition Types.hpp:33
Result of parsing a feature-only CSV (no response column).
Definition IO.hpp:126
std::vector< std::vector< std::string > > raw_rows
Definition IO.hpp:129
types::FeatureMatrix x
Definition IO.hpp:127
types::Names feature_names
Definition IO.hpp:128
Bundled dataset: features, response, and group labels.
Definition DataPacket.hpp:19