Commit 66804b93 authored by Guolin Ke's avatar Guolin Ke Committed by GitHub
Browse files

fixed bug for check having label or not for libsvm

parent 2f984f3a
...@@ -28,10 +28,10 @@ int GetLabelIdxForLibsvm(std::string& str, int num_features, int label_idx) { ...@@ -28,10 +28,10 @@ int GetLabelIdxForLibsvm(std::string& str, int num_features, int label_idx) {
str = Common::Trim(str); str = Common::Trim(str);
auto pos_space = str.find_first_of(" \f\n\r\t\v"); auto pos_space = str.find_first_of(" \f\n\r\t\v");
auto pos_colon = str.find_first_of(":"); auto pos_colon = str.find_first_of(":");
if (pos_colon == std::string::npos || pos_colon > pos_space) { if (pos_space == std::string::npos || pos_space < pos_colon) {
return -1;
} else {
return label_idx; return label_idx;
} else {
return -1;
} }
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment