We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent d2bf079 commit f52d331Copy full SHA for f52d331
src/deep_model.cc
@@ -99,20 +99,9 @@ int main(int argc, char* argv[]) {
99
for (std::string feature: features) {
100
std::vector<std::string> tokens;
101
util::split(feature, ':', tokens);
102
- int64 fieldid;
103
- int64 featureid;
104
- float value;
105
- int i = 0;
106
- for (std::string token: tokens) {
107
- if (i == 0) {
108
- fieldid = std::stoi(token);
109
- } else if (i == 1) {
110
- featureid = std::stoi(token);
111
- } else if (i == 2) {
112
- value = std::stof(token);
113
- }
114
- i++;
115
+ int64 fieldid = std::stoi(tokens[0]);
+ int64 featureid std::stoi(tokens[1]);
+ float value = std::stof(tokens[2]);
116
if (instance.find(fieldid) == instance.end()) {
117
std::unordered_map<int64, float> f;
118
f[featureid] = value;
0 commit comments