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

Function GetLabelIdxForLibsvm

src/io/parser.cpp:31–43  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

29}
30
31int GetLabelIdxForLibsvm(const std::string& str, int num_features, int label_idx) {
32 if (num_features <= 0) {
33 return label_idx;
34 }
35 auto str2 = Common::Trim(str);
36 auto pos_space = str2.find_first_of(" \f\n\r\t\v");
37 auto pos_colon = str2.find_first_of(":");
38 if (pos_space == std::string::npos || pos_space < pos_colon) {
39 return label_idx;
40 } else {
41 return -1;
42 }
43}
44
45int GetLabelIdxForTSV(const std::string& str, int num_features, int label_idx) {
46 if (num_features <= 0) {

Callers 1

CreateParserMethod · 0.70

Calls 1

TrimFunction · 0.50

Tested by

no test coverage detected