33 std::ifstream file(filename);
47 std::vector<std::string> lines;
55 std::getline(file, line);
58 while(std::getline(file, line))
60 lines.push_back(line);
66 std::random_device rd;
68 std::shuffle(lines.begin(), lines.end(), g);
70 std::vector<std::map<Subscripts, T>> pDs;
74 std::vector<pRC::Index> lengths(k, length);
78 ++lengths[remainder - 1];
87 std::map<Subscripts, T> pD;
91 for(
pRC::Index innerInd = 0; innerInd < lengths[ind]; ++innerInd)
93 line = lines[minInd + innerInd];
96 std::replace(line.begin(), line.end(),
',',
' ');
98 std::istringstream iss(line);
113 "Number of events differs for input file and "
126 minInd += lengths[ind];
129 for(
auto &[k, v] : pD)
136 return std::make_tuple(pDs, lengths);
static auto getCrossValSplits(std::string const &filename, pRC::Index const &k)
Splits the samples in a dataset into k as equal as possible sized sets that can be used for k-fold cr...
Definition get_cross_val_splits.hpp:30