config.cpp 15.2 KB
Newer Older
Guolin Ke's avatar
Guolin Ke committed
1
2
3
#include <LightGBM/config.h>

#include <LightGBM/utils/common.h>
Guolin Ke's avatar
Guolin Ke committed
4
#include <LightGBM/utils/random.h>
Guolin Ke's avatar
Guolin Ke committed
5
6
7
8
#include <LightGBM/utils/log.h>

#include <vector>
#include <string>
Guolin Ke's avatar
Guolin Ke committed
9
#include <unordered_set>
Guolin Ke's avatar
Guolin Ke committed
10
#include <algorithm>
Guolin Ke's avatar
Guolin Ke committed
11
#include <limits>
Guolin Ke's avatar
Guolin Ke committed
12
13
14

namespace LightGBM {

15
std::unordered_map<std::string, std::string> ConfigBase::Str2Map(const char* parameters) {
16
  std::unordered_map<std::string, std::string> params;
17
  auto args = Common::Split(parameters, " \t\n\r");
18
19
20
21
22
23
24
25
26
  for (auto arg : args) {
    std::vector<std::string> tmp_strs = Common::Split(arg.c_str(), '=');
    if (tmp_strs.size() == 2) {
      std::string key = Common::RemoveQuotationSymbol(Common::Trim(tmp_strs[0]));
      std::string value = Common::RemoveQuotationSymbol(Common::Trim(tmp_strs[1]));
      if (key.size() <= 0) {
        continue;
      }
      params[key] = value;
27
    } else if (Common::Trim(arg).size() > 0) {
Qiwei Ye's avatar
Qiwei Ye committed
28
      Log::Warning("Unknown parameter %s", arg.c_str());
29
30
31
    }
  }
  ParameterAlias::KeyAliasTransform(&params);
32
  return params;
33
34
}

Guolin Ke's avatar
Guolin Ke committed
35
36
37
void OverallConfig::Set(const std::unordered_map<std::string, std::string>& params) {
  // load main config types
  GetInt(params, "num_threads", &num_threads);
38
  GetString(params, "convert_model_language", &convert_model_language);
Guolin Ke's avatar
Guolin Ke committed
39
40
41
42

  // generate seeds by seed.
  if (GetInt(params, "seed", &seed)) {
    Random rand(seed);
Guolin Ke's avatar
Guolin Ke committed
43
44
45
46
47
    int int_max = std::numeric_limits<short>::max();
    io_config.data_random_seed = static_cast<int>(rand.NextShort(0, int_max));
    boosting_config.bagging_seed = static_cast<int>(rand.NextShort(0, int_max));
    boosting_config.drop_seed = static_cast<int>(rand.NextShort(0, int_max));
    boosting_config.tree_config.feature_fraction_seed = static_cast<int>(rand.NextShort(0, int_max));
Guolin Ke's avatar
Guolin Ke committed
48
  }
Guolin Ke's avatar
Guolin Ke committed
49
50
51
52
53
54
55
56
57
  GetTaskType(params);
  GetBoostingType(params);
  GetObjectiveType(params);
  GetMetricType(params);

  // sub-config setup
  network_config.Set(params);
  io_config.Set(params);

Guolin Ke's avatar
Guolin Ke committed
58
  boosting_config.Set(params);
Guolin Ke's avatar
Guolin Ke committed
59
60
61
62
  objective_config.Set(params);
  metric_config.Set(params);
  // check for conflicts
  CheckParamConflict();
Qiwei Ye's avatar
Qiwei Ye committed
63

Guolin Ke's avatar
Guolin Ke committed
64
  if (io_config.verbosity == 1) {
Qiwei Ye's avatar
Qiwei Ye committed
65
    LightGBM::Log::ResetLogLevel(LightGBM::LogLevel::Info);
66
  } else if (io_config.verbosity == 0) {
Qiwei Ye's avatar
Qiwei Ye committed
67
    LightGBM::Log::ResetLogLevel(LightGBM::LogLevel::Warning);
68
  } else if (io_config.verbosity >= 2) {
Qiwei Ye's avatar
Qiwei Ye committed
69
    LightGBM::Log::ResetLogLevel(LightGBM::LogLevel::Debug);
70
  } else {
Qiwei Ye's avatar
Qiwei Ye committed
71
    LightGBM::Log::ResetLogLevel(LightGBM::LogLevel::Fatal);
Guolin Ke's avatar
Guolin Ke committed
72
  }
Guolin Ke's avatar
Guolin Ke committed
73
74
75
76
77
}

void OverallConfig::GetBoostingType(const std::unordered_map<std::string, std::string>& params) {
  std::string value;
  if (GetString(params, "boosting_type", &value)) {
Guolin Ke's avatar
Guolin Ke committed
78
    std::transform(value.begin(), value.end(), value.begin(), Common::tolower);
Guolin Ke's avatar
Guolin Ke committed
79
    if (value == std::string("gbdt") || value == std::string("gbrt")) {
Guolin Ke's avatar
Guolin Ke committed
80
      boosting_type = "gbdt";
81
    } else if (value == std::string("dart")) {
Guolin Ke's avatar
Guolin Ke committed
82
      boosting_type = "dart";
Guolin Ke's avatar
Guolin Ke committed
83
84
    } else if (value == std::string("goss")) {
      boosting_type = "goss";
Guolin Ke's avatar
Guolin Ke committed
85
    } else {
86
      Log::Fatal("Unknown boosting type %s", value.c_str());
Guolin Ke's avatar
Guolin Ke committed
87
88
89
90
91
92
93
    }
  }
}

void OverallConfig::GetObjectiveType(const std::unordered_map<std::string, std::string>& params) {
  std::string value;
  if (GetString(params, "objective", &value)) {
Guolin Ke's avatar
Guolin Ke committed
94
    std::transform(value.begin(), value.end(), value.begin(), Common::tolower);
Guolin Ke's avatar
Guolin Ke committed
95
96
97
98
99
100
101
102
103
104
    objective_type = value;
  }
}

void OverallConfig::GetMetricType(const std::unordered_map<std::string, std::string>& params) {
  std::string value;
  if (GetString(params, "metric", &value)) {
    // clear old metrics
    metric_types.clear();
    // to lower
Guolin Ke's avatar
Guolin Ke committed
105
    std::transform(value.begin(), value.end(), value.begin(), Common::tolower);
Guolin Ke's avatar
Guolin Ke committed
106
107
    // split
    std::vector<std::string> metrics = Common::Split(value.c_str(), ',');
108
    // remove duplicate
Guolin Ke's avatar
Guolin Ke committed
109
    std::unordered_set<std::string> metric_sets;
Guolin Ke's avatar
Guolin Ke committed
110
    for (auto& metric : metrics) {
Guolin Ke's avatar
Guolin Ke committed
111
      std::transform(metric.begin(), metric.end(), metric.begin(), Common::tolower);
Guolin Ke's avatar
Guolin Ke committed
112
113
      if (metric_sets.count(metric) <= 0) {
        metric_sets.insert(metric);
Guolin Ke's avatar
Guolin Ke committed
114
115
      }
    }
Guolin Ke's avatar
Guolin Ke committed
116
117
    for (auto& metric : metric_sets) {
      metric_types.push_back(metric);
Guolin Ke's avatar
Guolin Ke committed
118
    }
Guolin Ke's avatar
Guolin Ke committed
119
    metric_types.shrink_to_fit();
Guolin Ke's avatar
Guolin Ke committed
120
121
122
123
124
125
126
  }
}


void OverallConfig::GetTaskType(const std::unordered_map<std::string, std::string>& params) {
  std::string value;
  if (GetString(params, "task", &value)) {
Guolin Ke's avatar
Guolin Ke committed
127
    std::transform(value.begin(), value.end(), value.begin(), Common::tolower);
Guolin Ke's avatar
Guolin Ke committed
128
129
130
131
132
    if (value == std::string("train") || value == std::string("training")) {
      task_type = TaskType::kTrain;
    } else if (value == std::string("predict") || value == std::string("prediction")
      || value == std::string("test")) {
      task_type = TaskType::kPredict;
133
134
    } else if (value == std::string("convert_model")) {
      task_type = TaskType::kConvertModel;
Guolin Ke's avatar
Guolin Ke committed
135
    } else {
136
      Log::Fatal("Unknown task type %s", value.c_str());
Guolin Ke's avatar
Guolin Ke committed
137
138
139
140
141
    }
  }
}

void OverallConfig::CheckParamConflict() {
142

143
  // check if objective_type, metric_type, and num_class match
Guolin Ke's avatar
Guolin Ke committed
144
145
  bool objective_type_multiclass = (objective_type == std::string("multiclass") 
                                    || objective_type == std::string("multiclassova"));
Guolin Ke's avatar
Guolin Ke committed
146
  int num_class_check = boosting_config.num_class;
147
  if (objective_type_multiclass) {
Guolin Ke's avatar
Guolin Ke committed
148
149
    if (num_class_check <= 1) {
      Log::Fatal("Number of classes should be specified and greater than 1 for multiclass training");
150
151
152
153
154
    }
  } else {
    if (task_type == TaskType::kTrain && num_class_check != 1) {
      Log::Fatal("Number of classes must be 1 for non-multiclass training");
    }
155
  }
wxchan's avatar
wxchan committed
156
157
  if (boosting_config.is_provide_training_metric || !io_config.valid_data_filenames.empty()) {
    for (std::string metric_type : metric_types) {
Guolin Ke's avatar
Guolin Ke committed
158
      bool metric_type_multiclass = (metric_type == std::string("multi_logloss") 
159
                                     || metric_type == std::string("multi_error"));
wxchan's avatar
wxchan committed
160
161
162
163
      if ((objective_type_multiclass && !metric_type_multiclass)
        || (!objective_type_multiclass && metric_type_multiclass)) {
        Log::Fatal("Objective and metrics don't match");
      }
164
    }
165
  }
166

Guolin Ke's avatar
Guolin Ke committed
167
168
169
170
  if (network_config.num_machines > 1) {
    is_parallel = true;
  } else {
    is_parallel = false;
171
    boosting_config.tree_learner_type = "serial";
Guolin Ke's avatar
Guolin Ke committed
172
173
  }

174
  if (boosting_config.tree_learner_type == std::string("serial")) {
Guolin Ke's avatar
Guolin Ke committed
175
176
177
178
    is_parallel = false;
    network_config.num_machines = 1;
  }

179
180
  if (boosting_config.tree_learner_type == std::string("serial") 
      || boosting_config.tree_learner_type == std::string("feature")) {
Guolin Ke's avatar
Guolin Ke committed
181
    is_parallel_find_bin = false;
182
183
  } else if (boosting_config.tree_learner_type == std::string("data")
             || boosting_config.tree_learner_type == std::string("voting")) {
Guolin Ke's avatar
Guolin Ke committed
184
    is_parallel_find_bin = true;
185
186
    if (boosting_config.tree_config.histogram_pool_size >= 0 
        && boosting_config.tree_learner_type == std::string("data")) {
187
      Log::Warning("Histogram LRU queue was enabled (histogram_pool_size=%f). Will disable this to reduce communication costs"
188
        , boosting_config.tree_config.histogram_pool_size);
tks's avatar
tks committed
189
      // Change pool size to -1 (no limit) when using data parallel to reduce communication costs
Guolin Ke's avatar
Guolin Ke committed
190
      boosting_config.tree_config.histogram_pool_size = -1;
191
192
    }

Guolin Ke's avatar
Guolin Ke committed
193
194
195
196
197
198
  }
}

void IOConfig::Set(const std::unordered_map<std::string, std::string>& params) {
  GetInt(params, "max_bin", &max_bin);
  CHECK(max_bin > 0);
199
  GetInt(params, "num_class", &num_class);
Guolin Ke's avatar
Guolin Ke committed
200
  GetInt(params, "data_random_seed", &data_random_seed);
201
  GetString(params, "data", &data_filename);
Qiwei Ye's avatar
Qiwei Ye committed
202
  GetInt(params, "verbose", &verbosity);
Guolin Ke's avatar
Guolin Ke committed
203
  GetInt(params, "num_iteration_predict", &num_iteration_predict);
Guolin Ke's avatar
Guolin Ke committed
204
  GetInt(params, "bin_construct_sample_cnt", &bin_construct_sample_cnt);
Guolin Ke's avatar
Guolin Ke committed
205
206
  GetBool(params, "is_pre_partition", &is_pre_partition);
  GetBool(params, "is_enable_sparse", &is_enable_sparse);
207
  GetDouble(params, "sparse_threshold", &sparse_threshold);
Guolin Ke's avatar
Guolin Ke committed
208
209
  GetBool(params, "use_two_round_loading", &use_two_round_loading);
  GetBool(params, "is_save_binary_file", &is_save_binary_file);
Guolin Ke's avatar
Guolin Ke committed
210
  GetBool(params, "enable_load_from_binary_file", &enable_load_from_binary_file);
Guolin Ke's avatar
Guolin Ke committed
211
212
  GetBool(params, "is_predict_raw_score", &is_predict_raw_score);
  GetBool(params, "is_predict_leaf_index", &is_predict_leaf_index);
Guolin Ke's avatar
Guolin Ke committed
213
  GetInt(params, "snapshot_freq", &snapshot_freq);
Guolin Ke's avatar
Guolin Ke committed
214
215
  GetString(params, "output_model", &output_model);
  GetString(params, "input_model", &input_model);
216
  GetString(params, "convert_model", &convert_model);
Guolin Ke's avatar
Guolin Ke committed
217
218
219
220
221
  GetString(params, "output_result", &output_result);
  std::string tmp_str = "";
  if (GetString(params, "valid_data", &tmp_str)) {
    valid_data_filenames = Common::Split(tmp_str.c_str(), ',');
  }
Guolin Ke's avatar
Guolin Ke committed
222
223
224
225
226
  GetBool(params, "has_header", &has_header);
  GetString(params, "label_column", &label_column);
  GetString(params, "weight_column", &weight_column);
  GetString(params, "group_column", &group_column);
  GetString(params, "ignore_column", &ignore_column);
227
  GetString(params, "categorical_column", &categorical_column);
Guolin Ke's avatar
Guolin Ke committed
228
  GetInt(params, "min_data_in_leaf", &min_data_in_leaf);
229
230
  GetInt(params, "min_data_in_bin", &min_data_in_bin);
  CHECK(min_data_in_bin > 0);
Guolin Ke's avatar
Guolin Ke committed
231
232
233
  GetDouble(params, "max_conflict_rate", &max_conflict_rate);
  GetBool(params, "enable_bundle", &enable_bundle);
  GetBool(params, "adjacent_bundle", &adjacent_bundle);
Guolin Ke's avatar
Guolin Ke committed
234
235
236
237
238
}


void ObjectiveConfig::Set(const std::unordered_map<std::string, std::string>& params) {
  GetBool(params, "is_unbalance", &is_unbalance);
239
  GetDouble(params, "sigmoid", &sigmoid);
Tsukasa OMOTO's avatar
Tsukasa OMOTO committed
240
  GetDouble(params, "huber_delta", &huber_delta);
Tsukasa OMOTO's avatar
Tsukasa OMOTO committed
241
  GetDouble(params, "fair_c", &fair_c);
242
  GetDouble(params, "gaussian_eta", &gaussian_eta);
243
  GetDouble(params, "poisson_max_delta_step", &poisson_max_delta_step);
Guolin Ke's avatar
Guolin Ke committed
244
245
  GetInt(params, "max_position", &max_position);
  CHECK(max_position > 0);
246
247
  GetInt(params, "num_class", &num_class);
  CHECK(num_class >= 1);
Guolin Ke's avatar
Guolin Ke committed
248
  GetDouble(params, "scale_pos_weight", &scale_pos_weight);
Guolin Ke's avatar
Guolin Ke committed
249
250
  std::string tmp_str = "";
  if (GetString(params, "label_gain", &tmp_str)) {
Guolin Ke's avatar
Guolin Ke committed
251
    label_gain = Common::StringToArray<double>(tmp_str, ',');
Guolin Ke's avatar
Guolin Ke committed
252
253
254
  } else {
    // label_gain = 2^i - 1, may overflow, so we use 31 here
    const int max_label = 31;
255
    label_gain.push_back(0.0f);
Guolin Ke's avatar
Guolin Ke committed
256
    for (int i = 1; i < max_label; ++i) {
257
      label_gain.push_back(static_cast<double>((1 << i) - 1));
Guolin Ke's avatar
Guolin Ke committed
258
259
    }
  }
Guolin Ke's avatar
Guolin Ke committed
260
  label_gain.shrink_to_fit();
Guolin Ke's avatar
Guolin Ke committed
261
262
263
264
}


void MetricConfig::Set(const std::unordered_map<std::string, std::string>& params) {
265
  GetDouble(params, "sigmoid", &sigmoid);
Tsukasa OMOTO's avatar
Tsukasa OMOTO committed
266
  GetDouble(params, "huber_delta", &huber_delta);
Tsukasa OMOTO's avatar
Tsukasa OMOTO committed
267
  GetDouble(params, "fair_c", &fair_c);
268
  GetInt(params, "num_class", &num_class);
Guolin Ke's avatar
Guolin Ke committed
269
270
  std::string tmp_str = "";
  if (GetString(params, "label_gain", &tmp_str)) {
Guolin Ke's avatar
Guolin Ke committed
271
    label_gain = Common::StringToArray<double>(tmp_str, ',');
Guolin Ke's avatar
Guolin Ke committed
272
273
274
  } else {
    // label_gain = 2^i - 1, may overflow, so we use 31 here
    const int max_label = 31;
275
    label_gain.push_back(0.0f);
Guolin Ke's avatar
Guolin Ke committed
276
    for (int i = 1; i < max_label; ++i) {
277
      label_gain.push_back(static_cast<double>((1 << i) - 1));
Guolin Ke's avatar
Guolin Ke committed
278
279
    }
  }
Guolin Ke's avatar
Guolin Ke committed
280
  label_gain.shrink_to_fit();
Guolin Ke's avatar
Guolin Ke committed
281
  if (GetString(params, "ndcg_eval_at", &tmp_str)) {
Guolin Ke's avatar
Guolin Ke committed
282
    eval_at = Common::StringToArray<int>(tmp_str, ',');
Guolin Ke's avatar
Guolin Ke committed
283
284
285
286
287
288
289
290
291
292
    std::sort(eval_at.begin(), eval_at.end());
    for (size_t i = 0; i < eval_at.size(); ++i) {
      CHECK(eval_at[i] > 0);
    }
  } else {
    // default eval ndcg @[1-5]
    for (int i = 1; i <= 5; ++i) {
      eval_at.push_back(i);
    }
  }
Guolin Ke's avatar
Guolin Ke committed
293
  eval_at.shrink_to_fit();
Guolin Ke's avatar
Guolin Ke committed
294
295
296
297
298
}


void TreeConfig::Set(const std::unordered_map<std::string, std::string>& params) {
  GetInt(params, "min_data_in_leaf", &min_data_in_leaf);
299
  GetDouble(params, "min_sum_hessian_in_leaf", &min_sum_hessian_in_leaf);
300
  CHECK(min_sum_hessian_in_leaf > 1.0f || min_data_in_leaf > 0);
301
  GetDouble(params, "lambda_l1", &lambda_l1);
302
303
304
305
306
307
  CHECK(lambda_l1 >= 0.0f);
  GetDouble(params, "lambda_l2", &lambda_l2);
  CHECK(lambda_l2 >= 0.0f);
  GetDouble(params, "min_gain_to_split", &min_gain_to_split);
  CHECK(min_gain_to_split >= 0.0f);
  GetInt(params, "num_leaves", &num_leaves);
308
  CHECK(num_leaves > 1);
Guolin Ke's avatar
Guolin Ke committed
309
  GetInt(params, "feature_fraction_seed", &feature_fraction_seed);
310
  GetDouble(params, "feature_fraction", &feature_fraction);
311
  CHECK(feature_fraction > 0.0f && feature_fraction <= 1.0f);
312
  GetDouble(params, "histogram_pool_size", &histogram_pool_size);
Guolin Ke's avatar
Guolin Ke committed
313
  GetInt(params, "max_depth", &max_depth);
Guolin Ke's avatar
Guolin Ke committed
314
  GetInt(params, "top_k", &top_k);
315
316
317
  GetInt(params, "gpu_platform_id", &gpu_platform_id);
  GetInt(params, "gpu_device_id", &gpu_device_id);
  GetBool(params, "gpu_use_dp", &gpu_use_dp);
Guolin Ke's avatar
Guolin Ke committed
318
319
320
321
322
}


void BoostingConfig::Set(const std::unordered_map<std::string, std::string>& params) {
  GetInt(params, "num_iterations", &num_iterations);
Guolin Ke's avatar
Guolin Ke committed
323
  GetDouble(params, "sigmoid", &sigmoid);
Guolin Ke's avatar
Guolin Ke committed
324
325
326
327
  CHECK(num_iterations >= 0);
  GetInt(params, "bagging_seed", &bagging_seed);
  GetInt(params, "bagging_freq", &bagging_freq);
  CHECK(bagging_freq >= 0);
328
  GetDouble(params, "bagging_fraction", &bagging_fraction);
329
  CHECK(bagging_fraction > 0.0f && bagging_fraction <= 1.0f);
330
  GetDouble(params, "learning_rate", &learning_rate);
331
  CHECK(learning_rate > 0.0f);
wxchan's avatar
wxchan committed
332
333
  GetInt(params, "early_stopping_round", &early_stopping_round);
  CHECK(early_stopping_round >= 0);
334
335
336
  GetInt(params, "metric_freq", &output_freq);
  CHECK(output_freq >= 0);
  GetBool(params, "is_training_metric", &is_provide_training_metric);
337
  GetInt(params, "num_class", &num_class);
Guolin Ke's avatar
Guolin Ke committed
338
  GetInt(params, "drop_seed", &drop_seed);
339
  GetDouble(params, "drop_rate", &drop_rate);
340
341
342
343
  GetDouble(params, "skip_drop", &skip_drop);
  GetInt(params, "max_drop", &max_drop);
  GetBool(params, "xgboost_dart_mode", &xgboost_dart_mode);
  GetBool(params, "uniform_drop", &uniform_drop);
Guolin Ke's avatar
Guolin Ke committed
344
345
  GetDouble(params, "top_rate", &top_rate);
  GetDouble(params, "other_rate", &other_rate);
346
  GetBool(params, "boost_from_average", &boost_from_average);
347
  CHECK(drop_rate <= 1.0 && drop_rate >= 0.0);
348
  CHECK(skip_drop <= 1.0 && skip_drop >= 0.0);
349
  GetDeviceType(params);
Guolin Ke's avatar
Guolin Ke committed
350
351
  GetTreeLearnerType(params);
  tree_config.Set(params);
Guolin Ke's avatar
Guolin Ke committed
352
353
}

Guolin Ke's avatar
Guolin Ke committed
354
void BoostingConfig::GetTreeLearnerType(const std::unordered_map<std::string, std::string>& params) {
Guolin Ke's avatar
Guolin Ke committed
355
356
  std::string value;
  if (GetString(params, "tree_learner", &value)) {
Guolin Ke's avatar
Guolin Ke committed
357
    std::transform(value.begin(), value.end(), value.begin(), Common::tolower);
Guolin Ke's avatar
Guolin Ke committed
358
    if (value == std::string("serial")) {
359
      tree_learner_type = "serial";
360
361
362
    } else if (value == std::string("gpu")) {
      tree_learner_type = "serial";
      device_type = "gpu";
Guolin Ke's avatar
Guolin Ke committed
363
    } else if (value == std::string("feature") || value == std::string("feature_parallel")) {
364
      tree_learner_type = "feature";
Guolin Ke's avatar
Guolin Ke committed
365
    } else if (value == std::string("data") || value == std::string("data_parallel")) {
366
      tree_learner_type = "data";
Guolin Ke's avatar
Guolin Ke committed
367
    } else if (value == std::string("voting") || value == std::string("voting_parallel")) {
368
      tree_learner_type = "voting";
Guolin Ke's avatar
Guolin Ke committed
369
    } else {
370
      Log::Fatal("Unknown tree learner type %s", value.c_str());
Guolin Ke's avatar
Guolin Ke committed
371
372
373
374
    }
  }
}

375
376
377
378
379
380
381
382
383
384
385
386
387
388
void BoostingConfig::GetDeviceType(const std::unordered_map<std::string, std::string>& params) {
  std::string value;
  if (GetString(params, "device", &value)) {
    std::transform(value.begin(), value.end(), value.begin(), Common::tolower);
    if (value == std::string("cpu")) {
      device_type = "cpu";
    } else if (value == std::string("gpu")) {
      device_type = "gpu";
    } else {
      Log::Fatal("Unknown device type %s", value.c_str());
    }
  }
}

Guolin Ke's avatar
Guolin Ke committed
389
390
391
392
393
394
395
396
397
398
399
void NetworkConfig::Set(const std::unordered_map<std::string, std::string>& params) {
  GetInt(params, "num_machines", &num_machines);
  CHECK(num_machines >= 1);
  GetInt(params, "local_listen_port", &local_listen_port);
  CHECK(local_listen_port > 0);
  GetInt(params, "time_out", &time_out);
  CHECK(time_out > 0);
  GetString(params, "machine_list_file", &machine_list_filename);
}

}  // namespace LightGBM