MCPcopy Create free account
hub / github.com/antmachineintelligence/mtgbmcode / GetLabelIdxForCSV

Function GetLabelIdxForCSV

src/io/parser.cpp:58–69  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

56}
57
58int GetLabelIdxForCSV(const std::string& str, int num_features, int label_idx) {
59 if (num_features <= 0) {
60 return label_idx;
61 }
62 auto str2 = Common::Trim(str);
63 auto tokens = Common::Split(str2.c_str(), ',');
64 if (static_cast<int>(tokens.size()) == num_features) {
65 return -1;
66 } else {
67 return label_idx;
68 }
69}
70
71enum DataType {
72 INVALID,

Callers 1

CreateParserMethod · 0.70

Calls 3

TrimFunction · 0.50
SplitFunction · 0.50
sizeMethod · 0.45

Tested by

no test coverage detected