MemoryError triggered when importing 'TopkDropoutStrategy' from qlib.contrib.strategy
Open
Nobody has claimed this yet.
bug
- Dominant language
- Python
- Stars
- 48.7k
- Forks
- 7.7k
- PR merge metrics
- No merged PRs in 30d
Description
from typing import Tuple
import pandas as pd
import qlib
from qlib.contrib.strategy import TopkDropoutStrategy
from qlib.data import D
from qlib.utils import hash_args, init_instance_by_config
if __name__ == "__main__":
qlib.init(
provider_uri=r"D:\qlib_data",
region="cn",
)
TRAIN_PERIODS: Tuple = ("2013-01-01", "2017-12-31")
VALID_PERIODS: Tuple = ("2018-01-01", "2019-12-31")
TEST_PERIODS: Tuple = ("2020-01-01", "2023-05-31")
dataset_config = {
"class": "DatasetH",
"module_path": "qlib.data.dataset",
"kwargs": {
"handler": {
"class": "Alpha158",
"module_path": "qlib.contrib.data.handler",
"kwargs": {
"start_time": TRAIN_PERIODS[0],
"end_time": TEST_PERIODS[1],
"fit_start_time": TRAIN_PERIODS[0],
"fit_end_time": TRAIN_PERIODS[1],
"instruments": "csi300",
},
},
"segments": {
"train": TRAIN_PERIODS,
"valid": VALID_PERIODS,
"test": TEST_PERIODS,
},
},
}
dataset = init_instance_by_config(dataset_config)
此时会报错
qlib版本为0.9.3
在注释掉from qlib.contrib.strategy import TopkDropoutStrategy后便不会有问题
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the issue with the supplied Python script and qlib 0.9.3, first importing TopkDropoutStrategy and then repeating with that import commented out. Start at the qlib.contrib.strategy import path and use the traceback shown in the linked screenshots to identify the cause; done means the import and subsequent dataset initialization complete without MemoryError.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- data, machine-learning
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100