-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Merge data selection to main * Update trainer for reweighter * Typos fixed. * update data selection interface * successfully run exp after refactor some interface * data selection share handler & trainer * fix meta model time series bug * fix online workflow set_uri bug * fix set_uri bug * updawte ds docs and delay trainer bug * docs * resume reweighter * add reweighting result * fix qlib model import * make recorder more friendly * fix experiment workflow bug * commit for merging master incase of conflictions * Successful run DDG-DA with a single command * remove unused code * asdd more docs * Update README.md * Update & fix some bugs. * Update configuration & remove debug functions * Update README.md * Modfify horizon from code rather than yaml * Update performance in README.md * fix part comments * Remove unfinished TCTS. * Fix some details. * Update meta docs * Update README.md of the benchmarks_dynamic * Update README.md files * Add README.md to the rolling_benchmark baseline. * Refine the docs and link * Rename README.md in benchmarks_dynamic. * Remove comments. * auto download data Co-authored-by: wendili-cs <wendili.academic@qq.com> Co-authored-by: demon143 <785696300@qq.com>
- Loading branch information
1 parent
184ce34
commit cf35562
Showing
52 changed files
with
2,440 additions
and
455 deletions.
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. | ||
|
||
.. 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. | ||
|
||
## 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.