20 #ifndef SUPERNN_DATA_HPP
21 #define SUPERNN_DATA_HPP
30 static const double FSMALL = 1e-9;
38 SInfo(
double _min,
double _max);
40 double scale(
const SInfo &to,
double value)
const;
47 struct SUPERNN_EXPORT
Bounds :
public std::vector<SInfo>
60 void merge_with(
const Bounds &other);
67 void save_file(std::ofstream &out)
const;
74 void load_file(std::ifstream &inp);
84 static void load_file(
const std::string &path, Bounds &from, Bounds &to);
90 typedef std::vector<double>
Row;
95 struct SUPERNN_EXPORT
Data :
public std::vector<Row>
106 Data(
unsigned rows,
unsigned cols);
114 Data drop_column(
unsigned col)
const;
130 Data(
unsigned rows,
unsigned cols,
const double st[]);
139 Data(
unsigned rows,
unsigned cols,
const Row &row);
153 Data sample(
unsigned first,
unsigned last)
const;
162 unsigned load_file(
const std::string &path);
170 void save_file(
const std::string &path)
const;
178 void save_info_file(
const std::string &path)
const;
195 void scale_column(
unsigned n,
const SInfo &curv,
const SInfo &newv);
213 void scale(
double min,
double max);
232 void k_fold(
unsigned n,
unsigned k, Data &p, Data &l)
const;
242 inline double get(
unsigned row,
unsigned col)
const
255 inline void set(
unsigned row,
unsigned col,
double val)
Bounds from
Original data bounds.
Minimum / maximum scaling information.
size_t n_total
Number of inputs + outputs per row.
Bounds to
Scaled data bounds.
Data scaling information, for all input and output neurons.
void set(unsigned row, unsigned col, double val)
Sets the value in the (row,col) cell to value.
std::vector< double > Row
Data row.
Data used in training, validation and testing.