| 14 | namespace LightGBM { |
| 15 | |
| 16 | void GetStatistic(const char* str, int* comma_cnt, int* tab_cnt, int* colon_cnt) { |
| 17 | *comma_cnt = 0; |
| 18 | *tab_cnt = 0; |
| 19 | *colon_cnt = 0; |
| 20 | for (int i = 0; str[i] != '\0'; ++i) { |
| 21 | if (str[i] == ',') { |
| 22 | ++(*comma_cnt); |
| 23 | } else if (str[i] == '\t') { |
| 24 | ++(*tab_cnt); |
| 25 | } else if (str[i] == ':') { |
| 26 | ++(*colon_cnt); |
| 27 | } |
| 28 | } |
| 29 | } |
| 30 | |
| 31 | int GetLabelIdxForLibsvm(const std::string& str, int num_features, int label_idx) { |
| 32 | if (num_features <= 0) { |