what happened? leaf_value have most value 100 , -100
when training,I found training error is too large. log below:
[LightGBM] [Info] Finished loading data in 37.422715 seconds [LightGBM] [Info] Total Bins 257321 [LightGBM] [Info] Number of data: 27529332, number of used features: 1694 [LightGBM] [Info] Finished initializing training [LightGBM] [Info] Started training... [LightGBM] [Info] Trained a tree with leaves=1023 and max_depth=12 [LightGBM] [Info] Iteration:1, training l2 : 988.97 [LightGBM] [Info] 143.878967 seconds elapsed, finished iteration 1 [LightGBM] [Info] Trained a tree with leaves=1023 and max_depth=12 [LightGBM] [Info] Iteration:2, training l2 : 658.242 [LightGBM] [Info] 303.504403 seconds elapsed, finished iteration 2 [LightGBM] [Info] Trained a tree with leaves=1023 and max_depth=12 [LightGBM] [Info] Iteration:3, training l2 : 401.259 [LightGBM] [Info] 468.440862 seconds elapsed, finished iteration 3 [LightGBM] [Info] Trained a tree with leaves=1023 and max_depth=12 [LightGBM] [Info] Iteration:4, training l2 : 221.76 [LightGBM] [Info] 629.556858 seconds elapsed, finished iteration 4 [LightGBM] [Info] Trained a tree with leaves=1023 and max_depth=12 [LightGBM] [Info] Iteration:5, training l2 : 135.788 [LightGBM] [Info] Trained a tree with leaves=1023 and max_depth=12 [LightGBM] [Info] Iteration:6, training l2 : 113.339 [LightGBM] [Info] 1005.897337 seconds elapsed, finished iteration 6 [LightGBM] [Info] Trained a tree with leaves=1023 and max_depth=12 [LightGBM] [Info] Iteration:7, training l2 : 106.062 [LightGBM] [Info] 1116.347294 seconds elapsed, finished iteration 7 [LightGBM] [Info] Trained a tree with leaves=1023 and max_depth=12 [LightGBM] [Info] Iteration:8, training l2 : 101.916 [LightGBM] [Info] 1267.562547 seconds elapsed, finished iteration 8 [LightGBM] [Info] Trained a tree with leaves=1023 and max_depth=12 [LightGBM] [Info] Iteration:9, training l2 : 100.249 [LightGBM] [Info] 1405.155376 seconds elapsed, finished iteration 9 [LightGBM] [Info] Trained a tree with leaves=1023 and max_depth=12 [LightGBM] [Info] Iteration:10, training l2 : 98.618 [LightGBM] [Info] 1544.943491 seconds elapsed, finished iteration 10 [LightGBM] [Info] Trained a tree with leaves=1023 and max_depth=12 [LightGBM] [Info] Iteration:11, training l2 : 97.2549 [LightGBM] [Info] 1692.742952 seconds elapsed, finished iteration 11 [LightGBM] [Info] Trained a tree with leaves=1023 and max_depth=12 [LightGBM] [Info] Iteration:12, training l2 : 9206.71 [LightGBM] [Info] 1792.214484 seconds elapsed, finished iteration 12 [LightGBM] [Info] No further splits with positive gain, best gain: -inf [LightGBM] [Info] Trained a tree with leaves=665 and max_depth=12 [LightGBM] [Info] Iteration:13, training l2 : 2053.83 [LightGBM] [Info] 1863.073878 seconds elapsed, finished iteration 13 [LightGBM] [Info] No further splits with positive gain, best gain: -inf [LightGBM] [Info] Trained a tree with leaves=783 and max_depth=12 [LightGBM] [Info] Iteration:14, training l2 : 970.311 [LightGBM] [Info] 1938.056689 seconds elapsed, finished iteration 14 [LightGBM] [Info] No further splits with positive gain, best gain: -inf [LightGBM] [Info] Trained a tree with leaves=991 and max_depth=12
data_model.txt file below:
Tree=11 leaf_value=0.0082561796236230636 100 -0.14689737626502855 -100 100 -15.002534942245445 2.6718082472956435 -6.5908630074976431 100 100 -100 -15.017993725709903 100 -5.7049102371097185 100 0.64749341900421009 -0.0069847474228686328 -0.47089925630733431 100 -8.6486830642845636 79.807276716068202 -0.2558033877779175 0.64931163008203852 -100 -100 -100 -100 -0.74844905493409364 -100 5.6040351548118919 0.67342211479639591 -0.10532849256658712 -100 5.1969921019976137 -100 0.047884156996104182 -100 -100 0.40962642223210727 -8.7292002908878725 26.647804133839447 -22.552134557151497 21.931341260549161 -2.0000718305879128 -1.3197301252276346 3.3065118670409768 2.0957457194801514 4.3383734301108738 17.811992894233132 1.1374991725849206 -30.069503019340885 -1.6768450680847256 0.79880326920984956 0.19429760461342829 -7.8559614802066378 -12.001371782830653 21.252225078389444 1.5438435853899977 0.10516160228183974 -5.4693152472715347 10.538458392542282 3.8651953555960752 0.24402520026491348 2.5417293449198004 -1.1120345280245623 6.9522709109985703 14.914966700579587 5.68716961543078 -28.597762654025559 0.78299033636216464 6.5994195126056541 2.9817881783207816 -0.75725984938854007 1.8898359235780231 0.23024143120571053 3.0446177528096445 -4.0948355662179372 1.7288704170056128 1.525269906024902 -3.9818208724133637 3.9903029419333098 -2.4635298046490792 1.0764522427372742 -0.93694743548722847 -0.15290708884085719 -0.81326972148452947 0.6560682690563806
@hlee13 it is by design. refer to : https://github.com/Microsoft/LightGBM/blob/master/include/LightGBM/tree.h#L13
BTW, a large range of regression target cannot be fitted well. It is better for you to use some transform (e.g log) to reduce the range of regression target.
what is the leaf value 100 means
it means the prediction score in that tree is 100. We limit its range explicitly to avoid the unstable trees.
what is the data reason lead to so large score, that make assign to 100.
@hlee13 You can check your label first, avoid the very large targets.
You also can try to use bigger min_data, which can reduce the bias of leaf output.
I used min_data, and the label range is [1, 1000]. the label range worked well ever.
@hlee13 can you provide the detailed parameters ? And what is your objective function ?
task = train boosting_type = gbdt objective = regression_l1 metric = l2 metric_freq = 1 is_training_metric = true max_bin = 255 data = data.train num_trees = 200 learning_rate = 0.1 num_leaves = 1023 max_depth = 12 snapshot_freq = 10 tree_learner = data feature_fraction = 0.9 bagging_freq = 5 bagging_fraction = 0.8 min_data_in_leaf = 100 min_sum_hessian_in_leaf = 5.0 is_enable_sparse = true use_two_round_loading = true is_save_binary_file = true is_pre_partition = true boost_from_average = false output_model = data_model.txt categorical_feature=1,2 num_machines = 2 local_listen_port = 12400 machine_list_file = mlist.txt
@hlee13 I see. I think the reason is the L1 objective:
https://github.com/Microsoft/LightGBM/blob/062bfa7964414ffcdf1a9000425d1187a19d3a82/src/objective/regression_objective.hpp#L96-L121
@henry0312 can you check this ? The grad / hess sometimes is large.
May L2 work well?
@hlee13 L2 is more smooth, and suit for most regression tasks.
This is because the l1 objective approximates delta function with Gaussian function.
So you need to adjust gaussian_eta parameter that controls the width of Gaussian function.
See:
- https://github.com/Microsoft/LightGBM/blob/062bfa7964414ffcdf1a9000425d1187a19d3a82/src/objective/regression_objective.hpp#L81
- https://github.com/Microsoft/LightGBM/blob/f8597c93bce24724349b8a17ffc4fab05b64e97c/include/LightGBM/utils/common.h#L483
BTW, why gaussian_eta doesn't apper in Parameters....?
@henry0312 you can create a PR to fix that.
@hlee13 cf. https://github.com/Microsoft/LightGBM/pull/178#issuecomment-271280902 for approximation with Gaussian function.
@guolinke OK. I'll create a PR.
should I set gaussian_eta less than 1.0?
@hlee13 It depends on your situation. just try :)
And I think you can also try l2 objective.
L2 objective also occur the problem.
@hlee13 can you provide more details ? like the output model.