-
Notifications
You must be signed in to change notification settings - Fork 4.8k
added KRNN and Sandwich models and their example results based on Alpha360 #1414
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
Merged
Merged
Changes from all commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
79ec062
Update README.md
yaxuan999 988da88
Update README.md
yaxuan999 6097212
Update README.md
yaxuan999 ef021a9
Add files via upload
yaxuan999 c581eae
Update README.md
yaxuan999 dea3965
Update README.md
yaxuan999 0d51d53
Update README.md
yaxuan999 347e065
Add files via upload
yaxuan999 f6f9442
Delete pytorch_krnn.py
yaxuan999 f953aef
Delete pytorch_sandwich.py
yaxuan999 62a8547
Add files via upload
yaxuan999 3b01cb5
Update pytorch_sandwich.py
yaxuan999 86119fc
Update pytorch_krnn.py
yaxuan999 deccdd0
Update pytorch_sandwich.py
yaxuan999 186d6a5
Update pytorch_krnn.py
yaxuan999 f4c4bfd
Update README.md
yaxuan999 64067a6
Update README.md
yaxuan999 ed76721
Update requirements.txt
yaxuan999 b928827
Update requirements.txt
yaxuan999 2b66c70
Update README.md
yaxuan999 0f16641
Update README.md
yaxuan999 91b3810
Update pytorch_sandwich.py
yaxuan999 9d107ac
Update link on index
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 hidden or 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 hidden or 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,8 @@ | ||
# KRNN | ||
* Code: [https://github.com/microsoft/FOST/blob/main/fostool/model/krnn.py](https://github.com/microsoft/FOST/blob/main/fostool/model/krnn.py) | ||
|
||
|
||
# Introductions about the settings/configs. | ||
* Torch_geometric is used in the original model in FOST, but we didn't use it. | ||
* make use your CUDA version matches the torch version to allow the usage of GPU, we use CUDA==10.2 and torch.__version__==1.12.1 | ||
|
This file contains hidden or 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,2 @@ | ||
numpy==1.23.4 | ||
pandas==1.5.2 |
91 changes: 91 additions & 0 deletions
91
examples/benchmarks/KRNN/workflow_config_krnn_Alpha360.yaml
This file contains hidden or 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,91 @@ | ||
qlib_init: | ||
provider_uri: "~/.qlib/qlib_data/cn_data" | ||
region: cn | ||
market: &market csi300 | ||
benchmark: &benchmark SH000300 | ||
data_handler_config: &data_handler_config | ||
start_time: 2008-01-01 | ||
end_time: 2020-08-01 | ||
fit_start_time: 2008-01-01 | ||
fit_end_time: 2014-12-31 | ||
instruments: *market | ||
infer_processors: | ||
- class: RobustZScoreNorm | ||
kwargs: | ||
fields_group: feature | ||
clip_outlier: true | ||
- class: Fillna | ||
kwargs: | ||
fields_group: feature | ||
learn_processors: | ||
- class: DropnaLabel | ||
- class: CSRankNorm | ||
kwargs: | ||
fields_group: label | ||
label: ["Ref($close, -2) / Ref($close, -1) - 1"] | ||
port_analysis_config: &port_analysis_config | ||
strategy: | ||
class: TopkDropoutStrategy | ||
module_path: qlib.contrib.strategy | ||
kwargs: | ||
signal: | ||
- <MODEL> | ||
- <DATASET> | ||
topk: 50 | ||
n_drop: 5 | ||
backtest: | ||
start_time: 2017-01-01 | ||
end_time: 2020-08-01 | ||
account: 100000000 | ||
benchmark: *benchmark | ||
exchange_kwargs: | ||
limit_threshold: 0.095 | ||
deal_price: close | ||
open_cost: 0.0005 | ||
close_cost: 0.0015 | ||
min_cost: 5 | ||
task: | ||
model: | ||
class: KRNN | ||
module_path: qlib.contrib.model.pytorch_krnn | ||
kwargs: | ||
fea_dim: 6 | ||
cnn_dim: 8 | ||
cnn_kernel_size: 3 | ||
rnn_dim: 8 | ||
rnn_dups: 2 | ||
rnn_layers: 2 | ||
n_epochs: 200 | ||
lr: 0.001 | ||
early_stop: 20 | ||
batch_size: 2000 | ||
metric: loss | ||
GPU: 0 | ||
dataset: | ||
class: DatasetH | ||
module_path: qlib.data.dataset | ||
kwargs: | ||
handler: | ||
class: Alpha360 | ||
module_path: qlib.contrib.data.handler | ||
kwargs: *data_handler_config | ||
segments: | ||
train: [2008-01-01, 2014-12-31] | ||
valid: [2015-01-01, 2016-12-31] | ||
test: [2017-01-01, 2020-08-01] | ||
record: | ||
- class: SignalRecord | ||
module_path: qlib.workflow.record_temp | ||
kwargs: | ||
model: <MODEL> | ||
dataset: <DATASET> | ||
- class: SigAnaRecord | ||
module_path: qlib.workflow.record_temp | ||
kwargs: | ||
ana_long_short: False | ||
ann_scaler: 252 | ||
- class: PortAnaRecord | ||
module_path: qlib.workflow.record_temp | ||
kwargs: | ||
config: *port_analysis_config | ||
|
This file contains hidden or 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 hidden or 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,8 @@ | ||
# Sandwich | ||
* Code: [https://github.com/microsoft/FOST/blob/main/fostool/model/sandwich.py](https://github.com/microsoft/FOST/blob/main/fostool/model/sandwich.py) | ||
you-n-g marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
|
||
# Introductions about the settings/configs. | ||
* Torch_geometric is used in the original model in FOST, but we didn't use it. | ||
make use your CUDA version matches the torch version to allow the usage of GPU, we use CUDA==10.2 and torch.version==1.12.1 | ||
|
This file contains hidden or 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,2 @@ | ||
numpy==1.23.4 | ||
pandas==1.5.2 |
93 changes: 93 additions & 0 deletions
93
examples/benchmarks/Sandwich/workflow_config_sandwich_Alpha360.yaml
This file contains hidden or 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,93 @@ | ||
qlib_init: | ||
provider_uri: "~/.qlib/qlib_data/cn_data" | ||
region: cn | ||
market: &market csi300 | ||
benchmark: &benchmark SH000300 | ||
data_handler_config: &data_handler_config | ||
start_time: 2008-01-01 | ||
end_time: 2020-08-01 | ||
fit_start_time: 2008-01-01 | ||
fit_end_time: 2014-12-31 | ||
instruments: *market | ||
infer_processors: | ||
- class: RobustZScoreNorm | ||
kwargs: | ||
fields_group: feature | ||
clip_outlier: true | ||
- class: Fillna | ||
kwargs: | ||
fields_group: feature | ||
learn_processors: | ||
- class: DropnaLabel | ||
- class: CSRankNorm | ||
kwargs: | ||
fields_group: label | ||
label: ["Ref($close, -2) / Ref($close, -1) - 1"] | ||
port_analysis_config: &port_analysis_config | ||
strategy: | ||
class: TopkDropoutStrategy | ||
module_path: qlib.contrib.strategy | ||
kwargs: | ||
signal: | ||
- <MODEL> | ||
- <DATASET> | ||
topk: 50 | ||
n_drop: 5 | ||
backtest: | ||
start_time: 2017-01-01 | ||
end_time: 2020-08-01 | ||
account: 100000000 | ||
benchmark: *benchmark | ||
exchange_kwargs: | ||
limit_threshold: 0.095 | ||
deal_price: close | ||
open_cost: 0.0005 | ||
close_cost: 0.0015 | ||
min_cost: 5 | ||
task: | ||
model: | ||
class: Sandwich | ||
module_path: qlib.contrib.model.pytorch_sandwich | ||
kwargs: | ||
fea_dim: 6 | ||
cnn_dim_1: 16 | ||
cnn_dim_2: 16 | ||
cnn_kernel_size: 3 | ||
rnn_dim_1: 8 | ||
rnn_dim_2: 8 | ||
rnn_dups: 2 | ||
rnn_layers: 2 | ||
n_epochs: 200 | ||
lr: 0.001 | ||
early_stop: 20 | ||
batch_size: 2000 | ||
metric: loss | ||
GPU: 0 | ||
dataset: | ||
class: DatasetH | ||
module_path: qlib.data.dataset | ||
kwargs: | ||
handler: | ||
class: Alpha360 | ||
module_path: qlib.contrib.data.handler | ||
kwargs: *data_handler_config | ||
segments: | ||
train: [2008-01-01, 2014-12-31] | ||
valid: [2015-01-01, 2016-12-31] | ||
test: [2017-01-01, 2020-08-01] | ||
record: | ||
- class: SignalRecord | ||
module_path: qlib.workflow.record_temp | ||
kwargs: | ||
model: <MODEL> | ||
dataset: <DATASET> | ||
- class: SigAnaRecord | ||
module_path: qlib.workflow.record_temp | ||
kwargs: | ||
ana_long_short: False | ||
ann_scaler: 252 | ||
- class: PortAnaRecord | ||
module_path: qlib.workflow.record_temp | ||
kwargs: | ||
config: *port_analysis_config | ||
|
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.
Uh oh!
There was an error while loading. Please reload this page.