mirror of
https://github.com/microsoft/qlib.git
synced 2026-07-16 01:06:56 +08:00
fix(gbdt): correct dtrain assignment in finetune() to use Dataset instead of tuple (#2049)
This commit is contained in:
@@ -51,7 +51,7 @@ class LGBModel(ModelFT, LightGBMFInt):
|
|||||||
w = reweighter.reweight(df)
|
w = reweighter.reweight(df)
|
||||||
else:
|
else:
|
||||||
raise ValueError("Unsupported reweighter type.")
|
raise ValueError("Unsupported reweighter type.")
|
||||||
ds_l.append((lgb.Dataset(x.values, label=y, weight=w), key))
|
ds_l.append((lgb.Dataset(x.values, label=y, weight=w, free_raw_data=False), key))
|
||||||
return ds_l
|
return ds_l
|
||||||
|
|
||||||
def fit(
|
def fit(
|
||||||
@@ -109,8 +109,10 @@ class LGBModel(ModelFT, LightGBMFInt):
|
|||||||
verbose level
|
verbose level
|
||||||
"""
|
"""
|
||||||
# Based on existing model and finetune by train more rounds
|
# Based on existing model and finetune by train more rounds
|
||||||
dtrain, _ = self._prepare_data(dataset, reweighter) # pylint: disable=W0632
|
ds_l = self._prepare_data(dataset, reweighter)
|
||||||
if dtrain.empty:
|
dtrain, _ = ds_l[0]
|
||||||
|
|
||||||
|
if dtrain.construct().num_data() == 0:
|
||||||
raise ValueError("Empty data from dataset, please check your dataset config.")
|
raise ValueError("Empty data from dataset, please check your dataset config.")
|
||||||
verbose_eval_callback = lgb.log_evaluation(period=verbose_eval)
|
verbose_eval_callback = lgb.log_evaluation(period=verbose_eval)
|
||||||
self.model = lgb.train(
|
self.model = lgb.train(
|
||||||
|
|||||||
Reference in New Issue
Block a user