mirror of
https://github.com/microsoft/qlib.git
synced 2026-07-14 00:06:58 +08:00
Add A New Baseline: DoubleEnsemble
This commit is contained in:
@@ -33,7 +33,7 @@ task:
|
|||||||
base: "gbm"
|
base: "gbm"
|
||||||
loss: mse
|
loss: mse
|
||||||
k: 6
|
k: 6
|
||||||
enable_sr: True
|
enable_sr: False
|
||||||
enable_fs: True
|
enable_fs: True
|
||||||
alpha1: 1
|
alpha1: 1
|
||||||
alpha2: 1
|
alpha2: 1
|
||||||
@@ -53,6 +53,7 @@ task:
|
|||||||
- 0.2
|
- 0.2
|
||||||
- 0.2
|
- 0.2
|
||||||
- 0.2
|
- 0.2
|
||||||
|
epochs: 28
|
||||||
colsample_bytree: 0.8879
|
colsample_bytree: 0.8879
|
||||||
learning_rate: 0.2
|
learning_rate: 0.2
|
||||||
subsample: 0.8789
|
subsample: 0.8789
|
||||||
@@ -62,8 +63,6 @@ task:
|
|||||||
num_leaves: 210
|
num_leaves: 210
|
||||||
num_threads: 20
|
num_threads: 20
|
||||||
verbosity: -1
|
verbosity: -1
|
||||||
num_iterations: 28
|
|
||||||
early_stopping_round: None
|
|
||||||
dataset:
|
dataset:
|
||||||
class: DatasetH
|
class: DatasetH
|
||||||
module_path: qlib.data.dataset
|
module_path: qlib.data.dataset
|
||||||
|
|||||||
@@ -38,28 +38,29 @@ task:
|
|||||||
module_path: qlib.contrib.model.double_ensemble
|
module_path: qlib.contrib.model.double_ensemble
|
||||||
kwargs:
|
kwargs:
|
||||||
base: "gbm"
|
base: "gbm"
|
||||||
loss: mse
|
loss: mse
|
||||||
k: 6
|
k: 6
|
||||||
enable_sr: True
|
enable_sr: True
|
||||||
enable_fs: True
|
enable_fs: True
|
||||||
alpha1: 1
|
alpha1: 1
|
||||||
alpha2: 1
|
alpha2: 1
|
||||||
bins_sr: 10
|
bins_sr: 10
|
||||||
bins_fs: 5
|
bins_fs: 5
|
||||||
decay: 0.5
|
decay: 0.5
|
||||||
sample_ratios:
|
sample_ratios:
|
||||||
- 0.8
|
- 0.8
|
||||||
- 0.7
|
- 0.7
|
||||||
- 0.6
|
- 0.6
|
||||||
- 0.5
|
- 0.5
|
||||||
- 0.4
|
- 0.4
|
||||||
sub_weights:
|
sub_weights:
|
||||||
- 1
|
- 1
|
||||||
- 0.2
|
- 0.2
|
||||||
- 0.2
|
- 0.2
|
||||||
- 0.2
|
- 0.2
|
||||||
- 0.2
|
- 0.2
|
||||||
- 0.2
|
- 0.2
|
||||||
|
epochs: 136
|
||||||
colsample_bytree: 0.8879
|
colsample_bytree: 0.8879
|
||||||
learning_rate: 0.0421
|
learning_rate: 0.0421
|
||||||
subsample: 0.8789
|
subsample: 0.8789
|
||||||
@@ -69,8 +70,6 @@ task:
|
|||||||
num_leaves: 210
|
num_leaves: 210
|
||||||
num_threads: 20
|
num_threads: 20
|
||||||
verbosity: -1
|
verbosity: -1
|
||||||
num_iterations: 28
|
|
||||||
early_stopping_round: None
|
|
||||||
dataset:
|
dataset:
|
||||||
class: DatasetH
|
class: DatasetH
|
||||||
module_path: qlib.data.dataset
|
module_path: qlib.data.dataset
|
||||||
|
|||||||
@@ -265,7 +265,7 @@ def run(times=1, models=None, dataset="Alpha360", exclude=False):
|
|||||||
) # TODO: FIX ME!
|
) # TODO: FIX ME!
|
||||||
else:
|
else:
|
||||||
execute(
|
execute(
|
||||||
f"cd {env_path} && {python_path} -m pip install --upgrade --force-reinstall -e git+https://github.com/microsoft/qlib#egg=pyqlib"
|
f"cd {env_path} && {python_path} -m pip install --upgrade --force-reinstall -e git+https://github.com/meng-ustc/qlib#egg=pyqlib"
|
||||||
) # TODO: FIX ME!
|
) # TODO: FIX ME!
|
||||||
sys.stderr.write("\n")
|
sys.stderr.write("\n")
|
||||||
# run workflow_by_config for multiple times
|
# run workflow_by_config for multiple times
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ class DEnsembleModel(Model):
|
|||||||
decay=None,
|
decay=None,
|
||||||
sample_ratios=None,
|
sample_ratios=None,
|
||||||
sub_weights=None,
|
sub_weights=None,
|
||||||
|
epochs=100,
|
||||||
**kwargs):
|
**kwargs):
|
||||||
self.base = base # "gbm" or "mlp", specifically, we use lgbm for "gbm"
|
self.base = base # "gbm" or "mlp", specifically, we use lgbm for "gbm"
|
||||||
self.k = k
|
self.k = k
|
||||||
@@ -44,6 +45,7 @@ class DEnsembleModel(Model):
|
|||||||
if not len(sub_weights) == k:
|
if not len(sub_weights) == k:
|
||||||
raise ValueError("The length of sub_weights should be equal to k.")
|
raise ValueError("The length of sub_weights should be equal to k.")
|
||||||
self.sub_weights = sub_weights
|
self.sub_weights = sub_weights
|
||||||
|
self.epochs = epochs
|
||||||
self.logger = get_module_logger("DEnsembleModel")
|
self.logger = get_module_logger("DEnsembleModel")
|
||||||
self.logger.info("Double Ensemble Model...")
|
self.logger.info("Double Ensemble Model...")
|
||||||
self.ensemble = [] # the current ensemble model, a list contains all the sub-models
|
self.ensemble = [] # the current ensemble model, a list contains all the sub-models
|
||||||
@@ -97,6 +99,7 @@ class DEnsembleModel(Model):
|
|||||||
model = lgb.train(
|
model = lgb.train(
|
||||||
self.params,
|
self.params,
|
||||||
dtrain,
|
dtrain,
|
||||||
|
num_boost_round=self.epochs,
|
||||||
valid_sets=[dtrain, dvalid],
|
valid_sets=[dtrain, dvalid],
|
||||||
valid_names=["train", "valid"],
|
valid_names=["train", "valid"],
|
||||||
verbose_eval=20,
|
verbose_eval=20,
|
||||||
|
|||||||
Reference in New Issue
Block a user