Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions docs/start/integration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -57,16 +57,17 @@ The Custom models need to inherit `qlib.model.base.Model <../reference/api.html#
dtrain = lgb.Dataset(x_train.values, label=y_train)
dvalid = lgb.Dataset(x_valid.values, label=y_valid)

# fit the model
# fit the model using callbacks (LightGBM >= 3.3.0)
early_stopping_callback = lgb.early_stopping(early_stopping_rounds)
verbose_eval_callback = lgb.log_evaluation(period=verbose_eval)
evals_result_callback = lgb.record_evaluation(evals_result)
self.model = lgb.train(
self.params,
dtrain,
num_boost_round=num_boost_round,
valid_sets=[dtrain, dvalid],
valid_names=["train", "valid"],
early_stopping_rounds=early_stopping_rounds,
verbose_eval=verbose_eval,
evals_result=evals_result,
callbacks=[early_stopping_callback, verbose_eval_callback, evals_result_callback],
**kwargs
)

Expand Down Expand Up @@ -94,14 +95,15 @@ The Custom models need to inherit `qlib.model.base.Model <../reference/api.html#
def finetune(self, dataset: DatasetH, num_boost_round=10, verbose_eval=20):
# Based on existing model and finetune by train more rounds
dtrain, _ = self._prepare_data(dataset)
verbose_eval_callback = lgb.log_evaluation(period=verbose_eval)
self.model = lgb.train(
self.params,
dtrain,
num_boost_round=num_boost_round,
init_model=self.model,
valid_sets=[dtrain],
valid_names=["train"],
verbose_eval=verbose_eval,
callbacks=[verbose_eval_callback],
)

Configuration File
Expand Down
2 changes: 1 addition & 1 deletion examples/benchmarks/DoubleEnsemble/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
pandas==1.1.2
numpy==1.21.0
lightgbm==3.1.0
lightgbm>=3.3.0
2 changes: 1 addition & 1 deletion examples/hyperparameter/LightGBM/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
pandas==1.1.2
numpy==1.21.0
lightgbm==3.1.0
lightgbm>=3.3.0
optuna==2.7.0
optuna-dashboard==0.4.1
5 changes: 4 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,10 @@ dependencies = [
"tqdm",
"pymongo",
"loguru",
"lightgbm",
# Since version 3.3.0, lightgbm supports the callback-based API
# (early_stopping(), log_evaluation(), record_evaluation()).
# The deprecated parameter-based API was removed in lightgbm 4.0.
"lightgbm>=3.3.0",
"gym",
"cvxpy",
"joblib",
Expand Down