34 std::ifstream file(filename);
48 std::vector<std::string> lines;
56 std::getline(file, line);
59 while(std::getline(file, line))
61 lines.push_back(line);
67 std::random_device rd;
69 std::shuffle(lines.begin(), lines.end(), g);
71 std::vector<std::map<Subscripts, T>> pDs;
75 std::vector<pRC::Index> lengths(k, length);
79 ++lengths[remainder - 1];
88 std::map<Subscripts, T> pD;
92 for(
pRC::Index innerInd = 0; innerInd < lengths[ind]; ++innerInd)
94 line = lines[minInd + innerInd];
97 std::replace(line.begin(), line.end(),
',',
' ');
99 std::istringstream iss(line);
114 "Number of events differs for input file and "
127 minInd += lengths[ind];
130 for(
auto &[k, v] : pD)
137 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:31