~/anaconda3/envs/trader/lib/python3.7/site-packages/lightgbmmt/basic.py in construct(self)
1089 init_score=self.init_score, predictor=self._predictor,
1090 silent=self.silent, feature_name=self.feature_name,
-> 1091 categorical_feature=self.categorical_feature, params=self.params)
1092 if self.free_raw_data:
1093 self.data = None
~/anaconda3/envs/trader/lib/python3.7/site-packages/lightgbmmt/basic.py in _lazy_init(self, data, label, reference, weight, group, init_score, predictor, silent, feature_name, categorical_feature, params)
913 if self._predictor is None and init_score is not None:
914 warnings.warn("The init_score will be overridden by the prediction of init_model.")
--> 915 self._set_init_score_by_predictor(predictor, data)
916 elif init_score is not None:
917 self.set_init_score(init_score)
~/anaconda3/envs/trader/lib/python3.7/site-packages/lightgbmmt/basic.py in set_init_score(self, init_score)
1433 if self.handle is not None and init_score is not None:
1434 init_score = list_to_1d_numpy(init_score, np.float64, name='init_score')
-> 1435 self.set_field('init_score', init_score)
1436 self.init_score = self.get_field('init_score') # original values can be modified at cpp side
1437 return self
Continue training with init_model raise LightGBMError: Number of class for initial score error
example code:
and it give STDERR:
`~/anaconda3/envs/trader/lib/python3.7/site-packages/lightgbmmt/engine.py in train(params, train_set, num_boost_round, valid_sets, valid_names, fobj, feval, init_model, feature_name, categorical_feature, early_stopping_rounds, evals_result, verbose_eval, learning_rates, keep_training_booster, callbacks) 226 # construct booster 227 try: --> 228 booster = Booster(params=params, train_set=train_set) 229 if is_valid_contain_train: 230 booster.set_train_data_name(train_data_name)
~/anaconda3/envs/trader/lib/python3.7/site-packages/lightgbmmt/basic.py in init(self, params, train_set, model_file, model_str, silent) 1732 train_set.construct().handle, 1733 c_str(params_str), -> 1734 ctypes.byref(self.handle))) 1735 # save reference to data 1736 self.train_set = train_set
~/anaconda3/envs/trader/lib/python3.7/site-packages/lightgbmmt/basic.py in _safe_call(ret) 43 """ 44 if ret != 0: ---> 45 raise LightGBMError(decode_string(_LIB.LGBM_GetLastError())) 46 47
LightGBMError: Number of class for initial score error`
BUG2: If I load model by filename during training (init_mode="path/of/model"), it raise another Error:
~/anaconda3/envs/trader/lib/python3.7/site-packages/lightgbmmt/engine.py in train(params, train_set, num_boost_round, valid_sets, valid_names, fobj, feval, init_model, feature_name, categorical_feature, early_stopping_rounds, evals_result, verbose_eval, learning_rates, keep_training_booster, callbacks) 226 # construct booster 227 try: --> 228 booster = Booster(params=params, train_set=train_set) 229 if is_valid_contain_train: 230 booster.set_train_data_name(train_data_name)
~/anaconda3/envs/trader/lib/python3.7/site-packages/lightgbmmt/basic.py in init(self, params, train_set, model_file, model_str, silent) 1730 self.handle = ctypes.c_void_p() 1731 _safe_call(_LIB.LGBM_BoosterCreate( -> 1732 train_set.construct().handle, 1733 c_str(params_str), 1734 ctypes.byref(self.handle)))
~/anaconda3/envs/trader/lib/python3.7/site-packages/lightgbmmt/basic.py in construct(self) 1089 init_score=self.init_score, predictor=self._predictor, 1090 silent=self.silent, feature_name=self.feature_name, -> 1091 categorical_feature=self.categorical_feature, params=self.params) 1092 if self.free_raw_data: 1093 self.data = None
~/anaconda3/envs/trader/lib/python3.7/site-packages/lightgbmmt/basic.py in _lazy_init(self, data, label, reference, weight, group, init_score, predictor, silent, feature_name, categorical_feature, params) 913 if self._predictor is None and init_score is not None: 914 warnings.warn("The init_score will be overridden by the prediction of init_model.") --> 915 self._set_init_score_by_predictor(predictor, data) 916 elif init_score is not None: 917 self.set_init_score(init_score)
~/anaconda3/envs/trader/lib/python3.7/site-packages/lightgbmmt/basic.py in _set_init_score_by_predictor(self, predictor, data, used_indices) 819 new_init_score[j num_data + i] = init_score[i predictor.num_class + j] 820 init_score = new_init_score --> 821 self.set_init_score(init_score) 822 823 def _lazy_init(self, data, label=None, reference=None,
~/anaconda3/envs/trader/lib/python3.7/site-packages/lightgbmmt/basic.py in set_init_score(self, init_score) 1433 if self.handle is not None and init_score is not None: 1434 init_score = list_to_1d_numpy(init_score, np.float64, name='init_score') -> 1435 self.set_field('init_score', init_score) 1436 self.init_score = self.get_field('init_score') # original values can be modified at cpp side 1437 return self
~/anaconda3/envs/trader/lib/python3.7/site-packages/lightgbmmt/basic.py in set_field(self, field_name, data) 1233 ptr_data, 1234 ctypes.c_int(len(data)), -> 1235 ctypes.c_int(type_data))) 1236 return self 1237
~/anaconda3/envs/trader/lib/python3.7/site-packages/lightgbmmt/basic.py in _safe_call(ret) 43 """ 44 if ret != 0: ---> 45 raise LightGBMError(decode_string(_LIB.LGBM_GetLastError())) 46 47
LightGBMError: Initial score size doesn't match data size