ppforest2 v0.1.0
Projection Pursuit Decision Trees and Random Forests
Loading...
Searching...
No Matches
IO.hpp File Reference

File I/O utilities, JSON and CSV reading/writing. More...

#include "stats/DataPacket.hpp"
#include "utils/Types.hpp"
#include <nlohmann/json.hpp>
#include <string>

Go to the source code of this file.

Namespaces

namespace  ppforest2
 
namespace  ppforest2::io
 
namespace  ppforest2::io::csv
 
namespace  ppforest2::io::json
 

Functions

void ppforest2::io::check_dir_not_exists (std::string const &path)
 Exit with an error if a directory already exists at the given path.
 
void ppforest2::io::check_file_not_exists (std::string const &path)
 Exit with an error if a file already exists at the given path.
 
std::string ppforest2::io::json::ensure_extension (std::string const &path)
 Ensure a file path ends with the ".json" extension.
 
stats::DataPacket ppforest2::io::csv::read (std::string const &filename)
 Read a CSV file into a DataPacket.
 
nlohmann::json ppforest2::io::json::read_file (std::string const &path)
 Read a JSON file and parse its contents.
 
stats::DataPacket ppforest2::io::csv::read_sorted (std::string const &filename)
 Read a CSV file and sort rows so that response groups are contiguous.
 
void ppforest2::io::csv::write (stats::DataPacket const &data, std::string const &filename)
 Write a DataPacket to a CSV file (features followed by label, no header).
 
void ppforest2::io::json::write_file (nlohmann::json const &data, std::string const &path)
 Write a JSON object to a file (pretty-printed with indent 2).
 

Detailed Description

File I/O utilities, JSON and CSV reading/writing.