Add scripts for Q

This commit is contained in:
D-X-Y 2021-03-11 13:07:08 +00:00
parent 58907a2387
commit 9f7eca0e58
5 changed files with 28 additions and 5 deletions

@ -1 +1 @@
Subproject commit 0ef7c8e0e62f1b08f89f676eac97cbbd2bcc1657 Subproject commit e626264d5aebfb28295abd00d44827621bec33a5

View File

@ -1,10 +1,11 @@
##################################################### #####################################################
# Copyright (c) Xuanyi Dong [GitHub D-X-Y], 2021.02 # # Copyright (c) Xuanyi Dong [GitHub D-X-Y], 2021.02 #
##################################################### #####################################################
# python exps/trading/baselines.py --alg MLP #
# python exps/trading/baselines.py --alg GRU # # python exps/trading/baselines.py --alg GRU #
# python exps/trading/baselines.py --alg LSTM # # python exps/trading/baselines.py --alg LSTM #
# python exps/trading/baselines.py --alg ALSTM # # python exps/trading/baselines.py --alg ALSTM #
# python exps/trading/baselines.py --alg MLP # # #
# python exps/trading/baselines.py --alg SFM # # python exps/trading/baselines.py --alg SFM #
# python exps/trading/baselines.py --alg XGBoost # # python exps/trading/baselines.py --alg XGBoost #
# python exps/trading/baselines.py --alg LightGBM # # python exps/trading/baselines.py --alg LightGBM #

View File

@ -80,7 +80,7 @@ def run_exp(task_config, dataset, experiment_name, recorder_name, uri):
# Train model # Train model
R.log_params(**flatten_dict(task_config)) R.log_params(**flatten_dict(task_config))
if "save_path" in inspect.getfullargspec(model.fit).args: if "save_path" in inspect.getfullargspec(model.fit).args:
model_fit_kwargs["save_path"] = os.path.join(recorder_root_dir, "model-ckps") model_fit_kwargs["save_path"] = os.path.join(recorder_root_dir, "model.ckps")
model.fit(**model_fit_kwargs) model.fit(**model_fit_kwargs)
# Get the recorder # Get the recorder
recorder = R.get_recorder() recorder = R.get_recorder()

View File

@ -17,7 +17,7 @@ import logging
from qlib.utils import ( from qlib.utils import (
unpack_archive_with_buffer, unpack_archive_with_buffer,
save_multiple_parts_file, save_multiple_parts_file,
create_save_path, get_or_create_path,
drop_nan_by_y_index, drop_nan_by_y_index,
) )
from qlib.log import get_module_logger, TimeInspector from qlib.log import get_module_logger, TimeInspector
@ -176,7 +176,7 @@ class QuantTransformer(Model):
_prepare_loader(test_dataset, False), _prepare_loader(test_dataset, False),
) )
save_path = create_save_path(save_path) save_path = get_or_create_path(save_path)
self.logger.info("Fit procedure for [{:}] with save path={:}".format(self.__class__.__name__, save_path)) self.logger.info("Fit procedure for [{:}] with save path={:}".format(self.__class__.__name__, save_path))
def _internal_test(ckp_epoch=None, results_dict=None): def _internal_test(ckp_epoch=None, results_dict=None):

22
scripts/trade/baseline.sh Normal file
View File

@ -0,0 +1,22 @@
#!/bin/bash
# bash scripts/trade/baseline.sh 0 csi300
set -e
echo script name: $0
echo $# arguments
if [ "$#" -ne 2 ] ;then
echo "Input illegal number of parameters " $#
exit 1
fi
gpu=$1
market=$2
algorithms="MLP GRU LSTM ALSTM XGBoost LightGBM"
for alg in ${algorithms}
do
python exps/trading/baselines.py --alg ${alg} --gpu ${gpu} --market ${market}
done