-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DDG-DA paper code #743
Merged
Merged
DDG-DA paper code #743
Changes from all commits
Commits
Show all changes
47 commits
Select commit
Hold shift + click to select a range
48f8694
Merge data selection to main
wendili-cs 5bb06cd
Update trainer for reweighter
wendili-cs 4f442f5
Typos fixed.
wendili-cs da013fd
Merge branch 'main' into ds
you-n-g 81b4383
update data selection interface
you-n-g aa2699f
successfully run exp after refactor some interface
you-n-g d17aaac
data selection share handler & trainer
you-n-g 82b4115
fix meta model time series bug
you-n-g 5b118c4
fix online workflow set_uri bug
you-n-g 3b073f7
fix set_uri bug
you-n-g 384b670
Merge remote-tracking branch 'origin/main' into ds
you-n-g b0850b0
updawte ds docs and delay trainer bug
you-n-g 051b261
Merge remote-tracking branch 'wd_ds/ds' into ds
you-n-g f10d726
Merge branch 'main' into ds
you-n-g cdcfe30
Merge remote-tracking branch 'origin/main' into ds
you-n-g 6d61ad0
Merge remote-tracking branch 'origin/main' into ds
you-n-g f32a7ad
docs
you-n-g 8fb37b6
resume reweighter
you-n-g 21baead
add reweighting result
you-n-g 12afe61
fix qlib model import
you-n-g 1d9732b
make recorder more friendly
you-n-g 20a8fe5
fix experiment workflow bug
you-n-g faf3e03
commit for merging master incase of conflictions
you-n-g 76d1bd9
Merge remote-tracking branch 'origin/main' into ds
you-n-g 3bc4030
Successful run DDG-DA with a single command
you-n-g 49c4074
remove unused code
you-n-g ce66d9a
asdd more docs
you-n-g cea134d
Update README.md
you-n-g a4a2b32
Update & fix some bugs.
demon143 8241832
Update configuration & remove debug functions
wendili-cs e1b079d
Update README.md
wendili-cs 6a3f471
Modfify horizon from code rather than yaml
wendili-cs c3364cd
Update performance in README.md
wendili-cs b3d1081
Merge remote-tracking branch 'origin/main' into ds
you-n-g fa2d047
fix part comments
you-n-g efab5cb
Remove unfinished TCTS.
wendili-cs 5a184eb
Fix some details.
wendili-cs 8fee1b4
Update meta docs
wendili-cs a31a4d5
Update README.md of the benchmarks_dynamic
wendili-cs ca3fe76
Merge branch 'main' into ds
you-n-g 97f61d5
Update README.md files
wendili-cs 2726560
Merge branch 'ds' of wd_git:you-n-g/qlib into ds
wendili-cs da68103
Add README.md to the rolling_benchmark baseline.
wendili-cs 7e1183b
Refine the docs and link
you-n-g b0857c2
Rename README.md in benchmarks_dynamic.
wendili-cs 38b83dd
Remove comments.
wendili-cs 34f5bd2
auto download data
you-n-g File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
.. _meta: | ||
|
||
================================= | ||
Meta Controller: Meta-Task & Meta-Dataset & Meta-Model | ||
================================= | ||
.. currentmodule:: qlib | ||
|
||
|
||
Introduction | ||
============= | ||
``Meta Controller`` provides guidance to ``Forecast Model``, which aims to learn regular patterns among a series of forecasting tasks and use learned patterns to guide forthcoming forecasting tasks. Users can implement their own meta-model instance based on ``Meta Controller`` module. | ||
|
||
Meta Task | ||
============= | ||
|
||
A `Meta Task` instance is the basic element in the meta-learning framework. It saves the data that can be used for the `Meta Model`. Multiple `Meta Task` instances may share the same `Data Handler`, controlled by `Meta Dataset`. Users should use `prepare_task_data()` to obtain the data that can be directly fed into the `Meta Model`. | ||
|
||
.. autoclass:: qlib.model.meta.task.MetaTask | ||
:members: | ||
|
||
Meta Dataset | ||
============= | ||
|
||
`Meta Dataset` controls the meta-information generating process. It is on the duty of providing data for training the `Meta Model`. Users should use `prepare_tasks` to retrieve a list of `Meta Task` instances. | ||
|
||
.. autoclass:: qlib.model.meta.dataset.MetaTaskDataset | ||
:members: | ||
|
||
Meta Model | ||
============= | ||
|
||
General Meta Model | ||
------------------ | ||
`Meta Model` instance is the part that controls the workflow. The usage of the `Meta Model` includes: | ||
1. Users train their `Meta Model` with the `fit` function. | ||
2. The `Meta Model` instance guides the workflow by giving useful information via the `inference` function. | ||
|
||
.. autoclass:: qlib.model.meta.model.MetaModel | ||
:members: | ||
|
||
Meta Task Model | ||
------------------ | ||
This type of meta-model may interact with task definitions directly. Then, the `Meta Task Model` is the class for them to inherit from. They guide the base tasks by modifying the base task definitions. The function `prepare_tasks` can be used to obtain the modified base task definitions. | ||
you-n-g marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
.. autoclass:: qlib.model.meta.model.MetaTaskModel | ||
:members: | ||
|
||
Meta Guide Model | ||
------------------ | ||
This type of meta-model participates in the training process of the base forecasting model. The meta-model may guide the base forecasting models during their training to improve their performances. | ||
|
||
.. autoclass:: qlib.model.meta.model.MetaGuideModel | ||
:members: | ||
|
||
|
||
Example | ||
============= | ||
``Qlib`` provides an implementation of ``Meta Model`` module, ``DDG-DA``, | ||
which adapts to the market dynamics. | ||
|
||
``DDG-DA`` includes four steps: | ||
|
||
1. Calculate meta-information and encapsulate it into ``Meta Task`` instances. All the meta-tasks form a ``Meta Dataset`` instance. | ||
2. Train ``DDG-DA`` based on the training data of the meta-dataset. | ||
3. Do the inference of the ``DDG-DA`` to get guide information. | ||
4. Apply guide information to the forecasting models to improve their performances. | ||
|
||
The `above example <https://github.com/microsoft/qlib/tree/main/examples/benchmarks_dynamic/DDG-DA>`_ can be found in ``examples/benchmarks_dynamic/DDG-DA/workflow.py``. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# Introduction | ||
This is the implementation of `DDG-DA` based on `Meta Controller` component provided by `Qlib`. | ||
|
||
## Background | ||
In many real-world scenarios, we often deal with streaming data that is sequentially collected over time. Due to the non-stationary nature of the environment, the streaming data distribution may change in unpredictable ways, which is known as concept drift. To handle concept drift, previous methods first detect when/where the concept drift happens and then adapt models to fit the distribution of the latest data. However, there are still many cases that some underlying factors of environment evolution are predictable, making it possible to model the future concept drift trend of the streaming data, while such cases are not fully explored in previous work. | ||
|
||
Therefore, we propose a novel method `DDG-DA`, that can effectively forecast the evolution of data distribution and improve the performance of models. Specifically, we first train a predictor to estimate the future data distribution, then leverage it to generate training samples, and finally train models on the generated data. | ||
|
||
## Dataset | ||
The data in the paper are private. So we conduct experiments on Qlib's public dataset. | ||
Though the dataset is different, the conclusion remains the same. By applying `DDG-DA`, users can see rising trends at the test phase both in the proxy models' ICs and the performances of the forecasting models. | ||
|
||
you-n-g marked this conversation as resolved.
Show resolved
Hide resolved
|
||
## Run the Code | ||
Users can try `DDG-DA` by running the following command: | ||
```bash | ||
python workflow.py run_all | ||
``` | ||
|
||
The default forecasting models are `Linear`. Users can choose other forecasting models by changing the `forecast_model` parameter when `DDG-DA` initializes. For example, users can try `LightGBM` forecasting models by running the following command: | ||
```bash | ||
python workflow.py --forecast_model="gbdt" run_all | ||
``` | ||
|
||
|
||
## Results | ||
|
||
The results of other methods in Qlib's public dataset can be found [here](../) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
torch==1.10.0 |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Check CI