config_auto.cpp 25.5 KB
Newer Older
1
2
3
4
5
6
7
/*!
 * Copyright (c) 2018 Microsoft Corporation. All rights reserved.
 * Licensed under the MIT License. See LICENSE file in the project root for license information.
 *
 * \note
 * This file is auto generated by LightGBM\helpers\parameter_generator.py from LightGBM\include\LightGBM\config.h file.
 */
Guolin Ke's avatar
Guolin Ke committed
8
9
#include<LightGBM/config.h>
namespace LightGBM {
jcipar's avatar
jcipar committed
10
11
const std::unordered_map<std::string, std::string>& Config::alias_table() {
  static std::unordered_map<std::string, std::string> aliases({
12
13
14
15
16
  {"config_file", "config"},
  {"task_type", "task"},
  {"objective_type", "objective"},
  {"app", "objective"},
  {"application", "objective"},
17
  {"loss", "objective"},
18
19
20
21
  {"boosting_type", "boosting"},
  {"boost", "boosting"},
  {"train", "data"},
  {"train_data", "data"},
22
  {"train_data_file", "data"},
23
24
25
26
27
  {"data_filename", "data"},
  {"test", "valid"},
  {"valid_data", "valid"},
  {"valid_data_file", "valid"},
  {"test_data", "valid"},
28
  {"test_data_file", "valid"},
29
30
  {"valid_filenames", "valid"},
  {"num_iteration", "num_iterations"},
31
  {"n_iter", "num_iterations"},
32
33
34
35
  {"num_tree", "num_iterations"},
  {"num_trees", "num_iterations"},
  {"num_round", "num_iterations"},
  {"num_rounds", "num_iterations"},
36
  {"nrounds", "num_iterations"},
37
38
  {"num_boost_round", "num_iterations"},
  {"n_estimators", "num_iterations"},
39
  {"max_iter", "num_iterations"},
40
  {"shrinkage_rate", "learning_rate"},
41
  {"eta", "learning_rate"},
42
  {"num_leaf", "num_leaves"},
43
44
  {"max_leaves", "num_leaves"},
  {"max_leaf", "num_leaves"},
45
  {"max_leaf_nodes", "num_leaves"},
46
  {"tree", "tree_learner"},
47
  {"tree_type", "tree_learner"},
48
49
50
51
  {"tree_learner_type", "tree_learner"},
  {"num_thread", "num_threads"},
  {"nthread", "num_threads"},
  {"nthreads", "num_threads"},
52
  {"n_jobs", "num_threads"},
53
  {"device", "device_type"},
54
  {"random_seed", "seed"},
55
  {"random_state", "seed"},
56
  {"hist_pool_size", "histogram_pool_size"},
57
58
59
  {"min_data_per_leaf", "min_data_in_leaf"},
  {"min_data", "min_data_in_leaf"},
  {"min_child_samples", "min_data_in_leaf"},
60
  {"min_samples_leaf", "min_data_in_leaf"},
61
62
63
64
65
66
67
  {"min_sum_hessian_per_leaf", "min_sum_hessian_in_leaf"},
  {"min_sum_hessian", "min_sum_hessian_in_leaf"},
  {"min_hessian", "min_sum_hessian_in_leaf"},
  {"min_child_weight", "min_sum_hessian_in_leaf"},
  {"sub_row", "bagging_fraction"},
  {"subsample", "bagging_fraction"},
  {"bagging", "bagging_fraction"},
Guolin Ke's avatar
Guolin Ke committed
68
69
70
71
72
73
  {"pos_sub_row", "pos_bagging_fraction"},
  {"pos_subsample", "pos_bagging_fraction"},
  {"pos_bagging", "pos_bagging_fraction"},
  {"neg_sub_row", "neg_bagging_fraction"},
  {"neg_subsample", "neg_bagging_fraction"},
  {"neg_bagging", "neg_bagging_fraction"},
74
75
76
77
  {"subsample_freq", "bagging_freq"},
  {"bagging_fraction_seed", "bagging_seed"},
  {"sub_feature", "feature_fraction"},
  {"colsample_bytree", "feature_fraction"},
78
79
  {"sub_feature_bynode", "feature_fraction_bynode"},
  {"colsample_bynode", "feature_fraction_bynode"},
Nikita Titov's avatar
Nikita Titov committed
80
  {"extra_tree", "extra_trees"},
81
82
  {"early_stopping_rounds", "early_stopping_round"},
  {"early_stopping", "early_stopping_round"},
83
  {"n_iter_no_change", "early_stopping_round"},
84
85
86
  {"max_tree_output", "max_delta_step"},
  {"max_leaf_output", "max_delta_step"},
  {"reg_alpha", "lambda_l1"},
87
  {"l1_regularization", "lambda_l1"},
88
  {"reg_lambda", "lambda_l2"},
89
  {"lambda", "lambda_l2"},
90
  {"l2_regularization", "lambda_l2"},
91
  {"min_split_gain", "min_gain_to_split"},
92
  {"rate_drop", "drop_rate"},
93
94
95
  {"topk", "top_k"},
  {"mc", "monotone_constraints"},
  {"monotone_constraint", "monotone_constraints"},
96
  {"monotonic_cst", "monotone_constraints"},
97
98
  {"monotone_constraining_method", "monotone_constraints_method"},
  {"mc_method", "monotone_constraints_method"},
99
100
101
  {"monotone_splits_penalty", "monotone_penalty"},
  {"ms_penalty", "monotone_penalty"},
  {"mc_penalty", "monotone_penalty"},
102
  {"feature_contrib", "feature_contri"},
Guolin Ke's avatar
Guolin Ke committed
103
104
105
  {"fc", "feature_contri"},
  {"fp", "feature_contri"},
  {"feature_penalty", "feature_contri"},
106
107
108
109
110
  {"fs", "forcedsplits_filename"},
  {"forced_splits_filename", "forcedsplits_filename"},
  {"forced_splits_file", "forcedsplits_filename"},
  {"forced_splits", "forcedsplits_filename"},
  {"verbose", "verbosity"},
111
112
  {"model_input", "input_model"},
  {"model_in", "input_model"},
113
114
  {"model_output", "output_model"},
  {"model_out", "output_model"},
115
  {"save_period", "snapshot_freq"},
Nikita Titov's avatar
Nikita Titov committed
116
  {"linear_trees", "linear_tree"},
117
  {"max_bins", "max_bin"},
118
119
120
121
122
  {"subsample_for_bin", "bin_construct_sample_cnt"},
  {"data_seed", "data_random_seed"},
  {"is_sparse", "is_enable_sparse"},
  {"enable_sparse", "is_enable_sparse"},
  {"sparse", "is_enable_sparse"},
123
124
  {"is_enable_bundle", "enable_bundle"},
  {"bundle", "enable_bundle"},
125
  {"is_pre_partition", "pre_partition"},
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
  {"two_round_loading", "two_round"},
  {"use_two_round_loading", "two_round"},
  {"has_header", "header"},
  {"label", "label_column"},
  {"weight", "weight_column"},
  {"group", "group_column"},
  {"group_id", "group_column"},
  {"query_column", "group_column"},
  {"query", "group_column"},
  {"query_id", "group_column"},
  {"ignore_feature", "ignore_column"},
  {"blacklist", "ignore_column"},
  {"cat_feature", "categorical_feature"},
  {"categorical_column", "categorical_feature"},
  {"cat_column", "categorical_feature"},
141
  {"categorical_features", "categorical_feature"},
142
143
  {"is_save_binary", "save_binary"},
  {"is_save_binary_file", "save_binary"},
144
145
146
147
148
149
150
  {"is_predict_raw_score", "predict_raw_score"},
  {"predict_rawscore", "predict_raw_score"},
  {"raw_score", "predict_raw_score"},
  {"is_predict_leaf_index", "predict_leaf_index"},
  {"leaf_index", "predict_leaf_index"},
  {"is_predict_contrib", "predict_contrib"},
  {"contrib", "predict_contrib"},
151
152
153
154
155
156
  {"predict_result", "output_result"},
  {"prediction_result", "output_result"},
  {"predict_name", "output_result"},
  {"prediction_name", "output_result"},
  {"pred_name", "output_result"},
  {"name_pred", "output_result"},
157
158
  {"convert_model_file", "convert_model"},
  {"num_classes", "num_class"},
159
  {"unbalance", "is_unbalance"},
160
161
162
163
164
165
166
167
168
  {"unbalanced_sets", "is_unbalance"},
  {"metrics", "metric"},
  {"metric_types", "metric"},
  {"output_freq", "metric_freq"},
  {"training_metric", "is_provide_training_metric"},
  {"is_training_metric", "is_provide_training_metric"},
  {"train_metric", "is_provide_training_metric"},
  {"ndcg_eval_at", "eval_at"},
  {"ndcg_at", "eval_at"},
169
170
  {"map_eval_at", "eval_at"},
  {"map_at", "eval_at"},
171
172
173
174
175
176
177
178
  {"num_machine", "num_machines"},
  {"local_port", "local_listen_port"},
  {"port", "local_listen_port"},
  {"machine_list_file", "machine_list_filename"},
  {"machine_list", "machine_list_filename"},
  {"mlist", "machine_list_filename"},
  {"workers", "machines"},
  {"nodes", "machines"},
jcipar's avatar
jcipar committed
179
180
181
  });
  return aliases;
}
Guolin Ke's avatar
Guolin Ke committed
182

jcipar's avatar
jcipar committed
183
184
const std::unordered_set<std::string>& Config::parameter_set() {
  static std::unordered_set<std::string> params({
185
186
187
188
189
190
191
192
193
194
195
196
197
  "config",
  "task",
  "objective",
  "boosting",
  "data",
  "valid",
  "num_iterations",
  "learning_rate",
  "num_leaves",
  "tree_learner",
  "num_threads",
  "device_type",
  "seed",
Guolin Ke's avatar
Guolin Ke committed
198
  "deterministic",
199
200
  "force_col_wise",
  "force_row_wise",
201
  "histogram_pool_size",
202
203
204
205
  "max_depth",
  "min_data_in_leaf",
  "min_sum_hessian_in_leaf",
  "bagging_fraction",
Guolin Ke's avatar
Guolin Ke committed
206
207
  "pos_bagging_fraction",
  "neg_bagging_fraction",
208
209
210
  "bagging_freq",
  "bagging_seed",
  "feature_fraction",
211
  "feature_fraction_bynode",
212
  "feature_fraction_seed",
213
214
  "extra_trees",
  "extra_seed",
215
  "early_stopping_round",
216
  "first_metric_only",
217
218
219
  "max_delta_step",
  "lambda_l1",
  "lambda_l2",
220
  "linear_lambda",
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
  "min_gain_to_split",
  "drop_rate",
  "max_drop",
  "skip_drop",
  "xgboost_dart_mode",
  "uniform_drop",
  "drop_seed",
  "top_rate",
  "other_rate",
  "min_data_per_group",
  "max_cat_threshold",
  "cat_l2",
  "cat_smooth",
  "max_cat_to_onehot",
  "top_k",
  "monotone_constraints",
237
  "monotone_constraints_method",
238
  "monotone_penalty",
Guolin Ke's avatar
Guolin Ke committed
239
  "feature_contri",
240
  "forcedsplits_filename",
Guolin Ke's avatar
Guolin Ke committed
241
  "refit_decay_rate",
242
243
244
245
  "cegb_tradeoff",
  "cegb_penalty_split",
  "cegb_penalty_feature_lazy",
  "cegb_penalty_feature_coupled",
Belinda Trotta's avatar
Belinda Trotta committed
246
  "path_smooth",
247
  "interaction_constraints",
248
  "verbosity",
249
250
  "input_model",
  "output_model",
251
  "saved_feature_importance_type",
252
  "snapshot_freq",
Nikita Titov's avatar
Nikita Titov committed
253
  "linear_tree",
254
  "max_bin",
Belinda Trotta's avatar
Belinda Trotta committed
255
  "max_bin_by_feature",
256
257
258
  "min_data_in_bin",
  "bin_construct_sample_cnt",
  "data_random_seed",
259
  "is_enable_sparse",
260
261
262
  "enable_bundle",
  "use_missing",
  "zero_as_missing",
263
264
  "feature_pre_filter",
  "pre_partition",
265
266
267
268
269
270
271
  "two_round",
  "header",
  "label_column",
  "weight_column",
  "group_column",
  "ignore_column",
  "categorical_feature",
272
273
  "forcedbins_filename",
  "save_binary",
Chen Yufei's avatar
Chen Yufei committed
274
  "precise_float_parser",
275
  "parser_config_file",
276
  "start_iteration_predict",
277
  "num_iteration_predict",
278
279
280
  "predict_raw_score",
  "predict_leaf_index",
  "predict_contrib",
281
  "predict_disable_shape_check",
282
283
284
  "pred_early_stop",
  "pred_early_stop_freq",
  "pred_early_stop_margin",
285
  "output_result",
286
287
  "convert_model_language",
  "convert_model",
288
  "objective_seed",
289
290
291
292
293
294
295
296
297
298
  "num_class",
  "is_unbalance",
  "scale_pos_weight",
  "sigmoid",
  "boost_from_average",
  "reg_sqrt",
  "alpha",
  "fair_c",
  "poisson_max_delta_step",
  "tweedie_variance_power",
299
300
  "lambdarank_truncation_level",
  "lambdarank_norm",
301
302
303
304
305
  "label_gain",
  "metric",
  "metric_freq",
  "is_provide_training_metric",
  "eval_at",
Belinda Trotta's avatar
Belinda Trotta committed
306
  "multi_error_top_k",
Belinda Trotta's avatar
Belinda Trotta committed
307
  "auc_mu_weights",
308
309
310
311
312
313
314
315
  "num_machines",
  "local_listen_port",
  "time_out",
  "machine_list_filename",
  "machines",
  "gpu_platform_id",
  "gpu_device_id",
  "gpu_use_dp",
316
  "num_gpu",
jcipar's avatar
jcipar committed
317
318
319
  });
  return params;
}
Guolin Ke's avatar
Guolin Ke committed
320
321
322
323
324
325
326
327
328
329

void Config::GetMembersFromString(const std::unordered_map<std::string, std::string>& params) {
  std::string tmp_str = "";
  GetString(params, "data", &data);

  if (GetString(params, "valid", &tmp_str)) {
    valid = Common::Split(tmp_str.c_str(), ',');
  }

  GetInt(params, "num_iterations", &num_iterations);
330
  CHECK_GE(num_iterations, 0);
Guolin Ke's avatar
Guolin Ke committed
331
332

  GetDouble(params, "learning_rate", &learning_rate);
333
  CHECK_GT(learning_rate, 0.0);
Guolin Ke's avatar
Guolin Ke committed
334
335

  GetInt(params, "num_leaves", &num_leaves);
336
337
  CHECK_GT(num_leaves, 1);
  CHECK_LE(num_leaves, 131072);
Guolin Ke's avatar
Guolin Ke committed
338
339
340

  GetInt(params, "num_threads", &num_threads);

Guolin Ke's avatar
Guolin Ke committed
341
342
  GetBool(params, "deterministic", &deterministic);

343
344
345
346
  GetBool(params, "force_col_wise", &force_col_wise);

  GetBool(params, "force_row_wise", &force_row_wise);

347
348
  GetDouble(params, "histogram_pool_size", &histogram_pool_size);

Guolin Ke's avatar
Guolin Ke committed
349
350
351
  GetInt(params, "max_depth", &max_depth);

  GetInt(params, "min_data_in_leaf", &min_data_in_leaf);
352
  CHECK_GE(min_data_in_leaf, 0);
Guolin Ke's avatar
Guolin Ke committed
353
354

  GetDouble(params, "min_sum_hessian_in_leaf", &min_sum_hessian_in_leaf);
355
  CHECK_GE(min_sum_hessian_in_leaf, 0.0);
Guolin Ke's avatar
Guolin Ke committed
356
357

  GetDouble(params, "bagging_fraction", &bagging_fraction);
358
359
  CHECK_GT(bagging_fraction, 0.0);
  CHECK_LE(bagging_fraction, 1.0);
Guolin Ke's avatar
Guolin Ke committed
360

Guolin Ke's avatar
Guolin Ke committed
361
  GetDouble(params, "pos_bagging_fraction", &pos_bagging_fraction);
362
363
  CHECK_GT(pos_bagging_fraction, 0.0);
  CHECK_LE(pos_bagging_fraction, 1.0);
Guolin Ke's avatar
Guolin Ke committed
364
365

  GetDouble(params, "neg_bagging_fraction", &neg_bagging_fraction);
366
367
  CHECK_GT(neg_bagging_fraction, 0.0);
  CHECK_LE(neg_bagging_fraction, 1.0);
Guolin Ke's avatar
Guolin Ke committed
368

Guolin Ke's avatar
Guolin Ke committed
369
370
371
372
373
  GetInt(params, "bagging_freq", &bagging_freq);

  GetInt(params, "bagging_seed", &bagging_seed);

  GetDouble(params, "feature_fraction", &feature_fraction);
374
375
  CHECK_GT(feature_fraction, 0.0);
  CHECK_LE(feature_fraction, 1.0);
Guolin Ke's avatar
Guolin Ke committed
376

377
  GetDouble(params, "feature_fraction_bynode", &feature_fraction_bynode);
378
379
  CHECK_GT(feature_fraction_bynode, 0.0);
  CHECK_LE(feature_fraction_bynode, 1.0);
380

Guolin Ke's avatar
Guolin Ke committed
381
382
  GetInt(params, "feature_fraction_seed", &feature_fraction_seed);

383
384
385
386
  GetBool(params, "extra_trees", &extra_trees);

  GetInt(params, "extra_seed", &extra_seed);

Guolin Ke's avatar
Guolin Ke committed
387
388
  GetInt(params, "early_stopping_round", &early_stopping_round);

389
390
  GetBool(params, "first_metric_only", &first_metric_only);

Guolin Ke's avatar
Guolin Ke committed
391
392
393
  GetDouble(params, "max_delta_step", &max_delta_step);

  GetDouble(params, "lambda_l1", &lambda_l1);
394
  CHECK_GE(lambda_l1, 0.0);
Guolin Ke's avatar
Guolin Ke committed
395
396

  GetDouble(params, "lambda_l2", &lambda_l2);
397
  CHECK_GE(lambda_l2, 0.0);
Guolin Ke's avatar
Guolin Ke committed
398

399
400
401
  GetDouble(params, "linear_lambda", &linear_lambda);
  CHECK_GE(linear_lambda, 0.0);

Guolin Ke's avatar
Guolin Ke committed
402
  GetDouble(params, "min_gain_to_split", &min_gain_to_split);
403
  CHECK_GE(min_gain_to_split, 0.0);
Guolin Ke's avatar
Guolin Ke committed
404
405

  GetDouble(params, "drop_rate", &drop_rate);
406
407
  CHECK_GE(drop_rate, 0.0);
  CHECK_LE(drop_rate, 1.0);
Guolin Ke's avatar
Guolin Ke committed
408
409
410
411

  GetInt(params, "max_drop", &max_drop);

  GetDouble(params, "skip_drop", &skip_drop);
412
413
  CHECK_GE(skip_drop, 0.0);
  CHECK_LE(skip_drop, 1.0);
Guolin Ke's avatar
Guolin Ke committed
414
415
416
417
418
419
420
421

  GetBool(params, "xgboost_dart_mode", &xgboost_dart_mode);

  GetBool(params, "uniform_drop", &uniform_drop);

  GetInt(params, "drop_seed", &drop_seed);

  GetDouble(params, "top_rate", &top_rate);
422
423
  CHECK_GE(top_rate, 0.0);
  CHECK_LE(top_rate, 1.0);
Guolin Ke's avatar
Guolin Ke committed
424
425

  GetDouble(params, "other_rate", &other_rate);
426
427
  CHECK_GE(other_rate, 0.0);
  CHECK_LE(other_rate, 1.0);
Guolin Ke's avatar
Guolin Ke committed
428
429

  GetInt(params, "min_data_per_group", &min_data_per_group);
430
  CHECK_GT(min_data_per_group, 0);
Guolin Ke's avatar
Guolin Ke committed
431
432

  GetInt(params, "max_cat_threshold", &max_cat_threshold);
433
  CHECK_GT(max_cat_threshold, 0);
Guolin Ke's avatar
Guolin Ke committed
434
435

  GetDouble(params, "cat_l2", &cat_l2);
436
  CHECK_GE(cat_l2, 0.0);
Guolin Ke's avatar
Guolin Ke committed
437
438

  GetDouble(params, "cat_smooth", &cat_smooth);
439
  CHECK_GE(cat_smooth, 0.0);
Guolin Ke's avatar
Guolin Ke committed
440
441

  GetInt(params, "max_cat_to_onehot", &max_cat_to_onehot);
442
  CHECK_GT(max_cat_to_onehot, 0);
Guolin Ke's avatar
Guolin Ke committed
443
444

  GetInt(params, "top_k", &top_k);
445
  CHECK_GT(top_k, 0);
Guolin Ke's avatar
Guolin Ke committed
446
447
448
449
450

  if (GetString(params, "monotone_constraints", &tmp_str)) {
    monotone_constraints = Common::StringToArray<int8_t>(tmp_str, ',');
  }

451
452
  GetString(params, "monotone_constraints_method", &monotone_constraints_method);

453
454
455
  GetDouble(params, "monotone_penalty", &monotone_penalty);
  CHECK_GE(monotone_penalty, 0.0);

Guolin Ke's avatar
Guolin Ke committed
456
457
458
459
  if (GetString(params, "feature_contri", &tmp_str)) {
    feature_contri = Common::StringToArray<double>(tmp_str, ',');
  }

Guolin Ke's avatar
Guolin Ke committed
460
461
  GetString(params, "forcedsplits_filename", &forcedsplits_filename);

Guolin Ke's avatar
Guolin Ke committed
462
  GetDouble(params, "refit_decay_rate", &refit_decay_rate);
463
464
  CHECK_GE(refit_decay_rate, 0.0);
  CHECK_LE(refit_decay_rate, 1.0);
Guolin Ke's avatar
Guolin Ke committed
465

466
  GetDouble(params, "cegb_tradeoff", &cegb_tradeoff);
467
  CHECK_GE(cegb_tradeoff, 0.0);
468
469

  GetDouble(params, "cegb_penalty_split", &cegb_penalty_split);
470
  CHECK_GE(cegb_penalty_split, 0.0);
471
472
473
474
475
476
477
478
479

  if (GetString(params, "cegb_penalty_feature_lazy", &tmp_str)) {
    cegb_penalty_feature_lazy = Common::StringToArray<double>(tmp_str, ',');
  }

  if (GetString(params, "cegb_penalty_feature_coupled", &tmp_str)) {
    cegb_penalty_feature_coupled = Common::StringToArray<double>(tmp_str, ',');
  }

Belinda Trotta's avatar
Belinda Trotta committed
480
481
482
  GetDouble(params, "path_smooth", &path_smooth);
  CHECK_GE(path_smooth,  0.0);

483
484
  GetString(params, "interaction_constraints", &interaction_constraints);

485
486
  GetInt(params, "verbosity", &verbosity);

487
488
489
490
  GetString(params, "input_model", &input_model);

  GetString(params, "output_model", &output_model);

491
492
  GetInt(params, "saved_feature_importance_type", &saved_feature_importance_type);

493
494
  GetInt(params, "snapshot_freq", &snapshot_freq);

Nikita Titov's avatar
Nikita Titov committed
495
496
  GetBool(params, "linear_tree", &linear_tree);

Guolin Ke's avatar
Guolin Ke committed
497
  GetInt(params, "max_bin", &max_bin);
498
  CHECK_GT(max_bin, 1);
Guolin Ke's avatar
Guolin Ke committed
499

Belinda Trotta's avatar
Belinda Trotta committed
500
501
502
503
  if (GetString(params, "max_bin_by_feature", &tmp_str)) {
    max_bin_by_feature = Common::StringToArray<int32_t>(tmp_str, ',');
  }

Guolin Ke's avatar
Guolin Ke committed
504
  GetInt(params, "min_data_in_bin", &min_data_in_bin);
505
  CHECK_GT(min_data_in_bin, 0);
Guolin Ke's avatar
Guolin Ke committed
506

507
  GetInt(params, "bin_construct_sample_cnt", &bin_construct_sample_cnt);
508
  CHECK_GT(bin_construct_sample_cnt, 0);
509

Guolin Ke's avatar
Guolin Ke committed
510
511
  GetInt(params, "data_random_seed", &data_random_seed);

512
  GetBool(params, "is_enable_sparse", &is_enable_sparse);
Guolin Ke's avatar
Guolin Ke committed
513

514
515
516
517
518
  GetBool(params, "enable_bundle", &enable_bundle);

  GetBool(params, "use_missing", &use_missing);

  GetBool(params, "zero_as_missing", &zero_as_missing);
Guolin Ke's avatar
Guolin Ke committed
519

520
  GetBool(params, "feature_pre_filter", &feature_pre_filter);
Guolin Ke's avatar
Guolin Ke committed
521

522
523
524
  GetBool(params, "pre_partition", &pre_partition);

  GetBool(params, "two_round", &two_round);
Guolin Ke's avatar
Guolin Ke committed
525
526
527
528
529
530
531
532
533
534
535
536
537

  GetBool(params, "header", &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);

  GetString(params, "categorical_feature", &categorical_feature);

538
539
540
541
  GetString(params, "forcedbins_filename", &forcedbins_filename);

  GetBool(params, "save_binary", &save_binary);

Chen Yufei's avatar
Chen Yufei committed
542
543
  GetBool(params, "precise_float_parser", &precise_float_parser);

544
545
  GetString(params, "parser_config_file", &parser_config_file);

546
547
  GetInt(params, "start_iteration_predict", &start_iteration_predict);

548
549
  GetInt(params, "num_iteration_predict", &num_iteration_predict);

Guolin Ke's avatar
Guolin Ke committed
550
551
552
553
554
555
  GetBool(params, "predict_raw_score", &predict_raw_score);

  GetBool(params, "predict_leaf_index", &predict_leaf_index);

  GetBool(params, "predict_contrib", &predict_contrib);

556
  GetBool(params, "predict_disable_shape_check", &predict_disable_shape_check);
Guolin Ke's avatar
Guolin Ke committed
557
558
559
560
561
562
563

  GetBool(params, "pred_early_stop", &pred_early_stop);

  GetInt(params, "pred_early_stop_freq", &pred_early_stop_freq);

  GetDouble(params, "pred_early_stop_margin", &pred_early_stop_margin);

564
  GetString(params, "output_result", &output_result);
565

Guolin Ke's avatar
Guolin Ke committed
566
567
568
569
  GetString(params, "convert_model_language", &convert_model_language);

  GetString(params, "convert_model", &convert_model);

570
571
  GetInt(params, "objective_seed", &objective_seed);

Guolin Ke's avatar
Guolin Ke committed
572
  GetInt(params, "num_class", &num_class);
573
  CHECK_GT(num_class, 0);
Guolin Ke's avatar
Guolin Ke committed
574

575
  GetBool(params, "is_unbalance", &is_unbalance);
Guolin Ke's avatar
Guolin Ke committed
576

577
  GetDouble(params, "scale_pos_weight", &scale_pos_weight);
578
  CHECK_GT(scale_pos_weight, 0.0);
Guolin Ke's avatar
Guolin Ke committed
579

580
  GetDouble(params, "sigmoid", &sigmoid);
581
  CHECK_GT(sigmoid, 0.0);
Guolin Ke's avatar
Guolin Ke committed
582
583
584

  GetBool(params, "boost_from_average", &boost_from_average);

585
  GetBool(params, "reg_sqrt", &reg_sqrt);
Guolin Ke's avatar
Guolin Ke committed
586

587
  GetDouble(params, "alpha", &alpha);
588
  CHECK_GT(alpha, 0.0);
Guolin Ke's avatar
Guolin Ke committed
589

590
  GetDouble(params, "fair_c", &fair_c);
591
  CHECK_GT(fair_c, 0.0);
592
593

  GetDouble(params, "poisson_max_delta_step", &poisson_max_delta_step);
594
  CHECK_GT(poisson_max_delta_step, 0.0);
Guolin Ke's avatar
Guolin Ke committed
595
596

  GetDouble(params, "tweedie_variance_power", &tweedie_variance_power);
597
598
  CHECK_GE(tweedie_variance_power, 1.0);
  CHECK_LT(tweedie_variance_power, 2.0);
599

600
  GetInt(params, "lambdarank_truncation_level", &lambdarank_truncation_level);
601
  CHECK_GT(lambdarank_truncation_level, 0);
Guolin Ke's avatar
Guolin Ke committed
602

603
  GetBool(params, "lambdarank_norm", &lambdarank_norm);
604

Guolin Ke's avatar
Guolin Ke committed
605
606
607
608
609
  if (GetString(params, "label_gain", &tmp_str)) {
    label_gain = Common::StringToArray<double>(tmp_str, ',');
  }

  GetInt(params, "metric_freq", &metric_freq);
610
  CHECK_GT(metric_freq, 0);
Guolin Ke's avatar
Guolin Ke committed
611
612
613
614
615
616
617

  GetBool(params, "is_provide_training_metric", &is_provide_training_metric);

  if (GetString(params, "eval_at", &tmp_str)) {
    eval_at = Common::StringToArray<int>(tmp_str, ',');
  }

Belinda Trotta's avatar
Belinda Trotta committed
618
  GetInt(params, "multi_error_top_k", &multi_error_top_k);
619
  CHECK_GT(multi_error_top_k, 0);
Belinda Trotta's avatar
Belinda Trotta committed
620

Belinda Trotta's avatar
Belinda Trotta committed
621
622
623
624
  if (GetString(params, "auc_mu_weights", &tmp_str)) {
    auc_mu_weights = Common::StringToArray<double>(tmp_str, ',');
  }

Guolin Ke's avatar
Guolin Ke committed
625
  GetInt(params, "num_machines", &num_machines);
626
  CHECK_GT(num_machines, 0);
Guolin Ke's avatar
Guolin Ke committed
627
628

  GetInt(params, "local_listen_port", &local_listen_port);
629
  CHECK_GT(local_listen_port, 0);
Guolin Ke's avatar
Guolin Ke committed
630
631

  GetInt(params, "time_out", &time_out);
632
  CHECK_GT(time_out, 0);
Guolin Ke's avatar
Guolin Ke committed
633
634
635
636
637
638
639
640
641
642

  GetString(params, "machine_list_filename", &machine_list_filename);

  GetString(params, "machines", &machines);

  GetInt(params, "gpu_platform_id", &gpu_platform_id);

  GetInt(params, "gpu_device_id", &gpu_device_id);

  GetBool(params, "gpu_use_dp", &gpu_use_dp);
643
644
645

  GetInt(params, "num_gpu", &num_gpu);
  CHECK_GT(num_gpu, 0);
Guolin Ke's avatar
Guolin Ke committed
646
647
648
649
650
}

std::string Config::SaveMembersToString() const {
  std::stringstream str_buf;
  str_buf << "[data: " << data << "]\n";
651
  str_buf << "[valid: " << Common::Join(valid, ",") << "]\n";
Guolin Ke's avatar
Guolin Ke committed
652
653
654
655
  str_buf << "[num_iterations: " << num_iterations << "]\n";
  str_buf << "[learning_rate: " << learning_rate << "]\n";
  str_buf << "[num_leaves: " << num_leaves << "]\n";
  str_buf << "[num_threads: " << num_threads << "]\n";
Guolin Ke's avatar
Guolin Ke committed
656
  str_buf << "[deterministic: " << deterministic << "]\n";
657
658
  str_buf << "[force_col_wise: " << force_col_wise << "]\n";
  str_buf << "[force_row_wise: " << force_row_wise << "]\n";
659
  str_buf << "[histogram_pool_size: " << histogram_pool_size << "]\n";
Guolin Ke's avatar
Guolin Ke committed
660
661
662
663
  str_buf << "[max_depth: " << max_depth << "]\n";
  str_buf << "[min_data_in_leaf: " << min_data_in_leaf << "]\n";
  str_buf << "[min_sum_hessian_in_leaf: " << min_sum_hessian_in_leaf << "]\n";
  str_buf << "[bagging_fraction: " << bagging_fraction << "]\n";
Guolin Ke's avatar
Guolin Ke committed
664
665
  str_buf << "[pos_bagging_fraction: " << pos_bagging_fraction << "]\n";
  str_buf << "[neg_bagging_fraction: " << neg_bagging_fraction << "]\n";
Guolin Ke's avatar
Guolin Ke committed
666
667
668
  str_buf << "[bagging_freq: " << bagging_freq << "]\n";
  str_buf << "[bagging_seed: " << bagging_seed << "]\n";
  str_buf << "[feature_fraction: " << feature_fraction << "]\n";
669
  str_buf << "[feature_fraction_bynode: " << feature_fraction_bynode << "]\n";
Guolin Ke's avatar
Guolin Ke committed
670
  str_buf << "[feature_fraction_seed: " << feature_fraction_seed << "]\n";
671
672
  str_buf << "[extra_trees: " << extra_trees << "]\n";
  str_buf << "[extra_seed: " << extra_seed << "]\n";
Guolin Ke's avatar
Guolin Ke committed
673
  str_buf << "[early_stopping_round: " << early_stopping_round << "]\n";
674
  str_buf << "[first_metric_only: " << first_metric_only << "]\n";
Guolin Ke's avatar
Guolin Ke committed
675
676
677
  str_buf << "[max_delta_step: " << max_delta_step << "]\n";
  str_buf << "[lambda_l1: " << lambda_l1 << "]\n";
  str_buf << "[lambda_l2: " << lambda_l2 << "]\n";
678
  str_buf << "[linear_lambda: " << linear_lambda << "]\n";
Guolin Ke's avatar
Guolin Ke committed
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
  str_buf << "[min_gain_to_split: " << min_gain_to_split << "]\n";
  str_buf << "[drop_rate: " << drop_rate << "]\n";
  str_buf << "[max_drop: " << max_drop << "]\n";
  str_buf << "[skip_drop: " << skip_drop << "]\n";
  str_buf << "[xgboost_dart_mode: " << xgboost_dart_mode << "]\n";
  str_buf << "[uniform_drop: " << uniform_drop << "]\n";
  str_buf << "[drop_seed: " << drop_seed << "]\n";
  str_buf << "[top_rate: " << top_rate << "]\n";
  str_buf << "[other_rate: " << other_rate << "]\n";
  str_buf << "[min_data_per_group: " << min_data_per_group << "]\n";
  str_buf << "[max_cat_threshold: " << max_cat_threshold << "]\n";
  str_buf << "[cat_l2: " << cat_l2 << "]\n";
  str_buf << "[cat_smooth: " << cat_smooth << "]\n";
  str_buf << "[max_cat_to_onehot: " << max_cat_to_onehot << "]\n";
  str_buf << "[top_k: " << top_k << "]\n";
694
  str_buf << "[monotone_constraints: " << Common::Join(Common::ArrayCast<int8_t, int>(monotone_constraints), ",") << "]\n";
695
  str_buf << "[monotone_constraints_method: " << monotone_constraints_method << "]\n";
696
  str_buf << "[monotone_penalty: " << monotone_penalty << "]\n";
697
  str_buf << "[feature_contri: " << Common::Join(feature_contri, ",") << "]\n";
Guolin Ke's avatar
Guolin Ke committed
698
  str_buf << "[forcedsplits_filename: " << forcedsplits_filename << "]\n";
Guolin Ke's avatar
Guolin Ke committed
699
  str_buf << "[refit_decay_rate: " << refit_decay_rate << "]\n";
700
701
702
703
  str_buf << "[cegb_tradeoff: " << cegb_tradeoff << "]\n";
  str_buf << "[cegb_penalty_split: " << cegb_penalty_split << "]\n";
  str_buf << "[cegb_penalty_feature_lazy: " << Common::Join(cegb_penalty_feature_lazy, ",") << "]\n";
  str_buf << "[cegb_penalty_feature_coupled: " << Common::Join(cegb_penalty_feature_coupled, ",") << "]\n";
Belinda Trotta's avatar
Belinda Trotta committed
704
  str_buf << "[path_smooth: " << path_smooth << "]\n";
705
  str_buf << "[interaction_constraints: " << interaction_constraints << "]\n";
706
  str_buf << "[verbosity: " << verbosity << "]\n";
707
  str_buf << "[saved_feature_importance_type: " << saved_feature_importance_type << "]\n";
Nikita Titov's avatar
Nikita Titov committed
708
  str_buf << "[linear_tree: " << linear_tree << "]\n";
Guolin Ke's avatar
Guolin Ke committed
709
  str_buf << "[max_bin: " << max_bin << "]\n";
Belinda Trotta's avatar
Belinda Trotta committed
710
  str_buf << "[max_bin_by_feature: " << Common::Join(max_bin_by_feature, ",") << "]\n";
Guolin Ke's avatar
Guolin Ke committed
711
  str_buf << "[min_data_in_bin: " << min_data_in_bin << "]\n";
712
  str_buf << "[bin_construct_sample_cnt: " << bin_construct_sample_cnt << "]\n";
Guolin Ke's avatar
Guolin Ke committed
713
  str_buf << "[data_random_seed: " << data_random_seed << "]\n";
714
  str_buf << "[is_enable_sparse: " << is_enable_sparse << "]\n";
715
716
717
  str_buf << "[enable_bundle: " << enable_bundle << "]\n";
  str_buf << "[use_missing: " << use_missing << "]\n";
  str_buf << "[zero_as_missing: " << zero_as_missing << "]\n";
718
719
  str_buf << "[feature_pre_filter: " << feature_pre_filter << "]\n";
  str_buf << "[pre_partition: " << pre_partition << "]\n";
Guolin Ke's avatar
Guolin Ke committed
720
721
722
723
724
725
726
  str_buf << "[two_round: " << two_round << "]\n";
  str_buf << "[header: " << header << "]\n";
  str_buf << "[label_column: " << label_column << "]\n";
  str_buf << "[weight_column: " << weight_column << "]\n";
  str_buf << "[group_column: " << group_column << "]\n";
  str_buf << "[ignore_column: " << ignore_column << "]\n";
  str_buf << "[categorical_feature: " << categorical_feature << "]\n";
727
  str_buf << "[forcedbins_filename: " << forcedbins_filename << "]\n";
Chen Yufei's avatar
Chen Yufei committed
728
  str_buf << "[precise_float_parser: " << precise_float_parser << "]\n";
729
  str_buf << "[parser_config_file: " << parser_config_file << "]\n";
730
  str_buf << "[objective_seed: " << objective_seed << "]\n";
Guolin Ke's avatar
Guolin Ke committed
731
  str_buf << "[num_class: " << num_class << "]\n";
732
733
  str_buf << "[is_unbalance: " << is_unbalance << "]\n";
  str_buf << "[scale_pos_weight: " << scale_pos_weight << "]\n";
Guolin Ke's avatar
Guolin Ke committed
734
  str_buf << "[sigmoid: " << sigmoid << "]\n";
735
736
  str_buf << "[boost_from_average: " << boost_from_average << "]\n";
  str_buf << "[reg_sqrt: " << reg_sqrt << "]\n";
Guolin Ke's avatar
Guolin Ke committed
737
738
739
740
  str_buf << "[alpha: " << alpha << "]\n";
  str_buf << "[fair_c: " << fair_c << "]\n";
  str_buf << "[poisson_max_delta_step: " << poisson_max_delta_step << "]\n";
  str_buf << "[tweedie_variance_power: " << tweedie_variance_power << "]\n";
741
742
  str_buf << "[lambdarank_truncation_level: " << lambdarank_truncation_level << "]\n";
  str_buf << "[lambdarank_norm: " << lambdarank_norm << "]\n";
743
744
  str_buf << "[label_gain: " << Common::Join(label_gain, ",") << "]\n";
  str_buf << "[eval_at: " << Common::Join(eval_at, ",") << "]\n";
Belinda Trotta's avatar
Belinda Trotta committed
745
  str_buf << "[multi_error_top_k: " << multi_error_top_k << "]\n";
Belinda Trotta's avatar
Belinda Trotta committed
746
  str_buf << "[auc_mu_weights: " << Common::Join(auc_mu_weights, ",") << "]\n";
Guolin Ke's avatar
Guolin Ke committed
747
748
749
750
751
752
753
754
  str_buf << "[num_machines: " << num_machines << "]\n";
  str_buf << "[local_listen_port: " << local_listen_port << "]\n";
  str_buf << "[time_out: " << time_out << "]\n";
  str_buf << "[machine_list_filename: " << machine_list_filename << "]\n";
  str_buf << "[machines: " << machines << "]\n";
  str_buf << "[gpu_platform_id: " << gpu_platform_id << "]\n";
  str_buf << "[gpu_device_id: " << gpu_device_id << "]\n";
  str_buf << "[gpu_use_dp: " << gpu_use_dp << "]\n";
755
  str_buf << "[num_gpu: " << num_gpu << "]\n";
Guolin Ke's avatar
Guolin Ke committed
756
757
758
  return str_buf.str();
}

759
}  // namespace LightGBM