1
0
mirror of https://github.com/microsoft/qlib.git synced 2026-06-06 05:51:17 +08:00
This commit is contained in:
Jactus
2020-12-04 10:31:50 +08:00
parent 2cb888c8b9
commit f237a344c3
4 changed files with 18 additions and 37 deletions

View File

@@ -135,9 +135,9 @@ def get_all_folders(models, exclude) -> dict:
# function to get all the files under the model folder
def get_all_files(folder_path) -> (str, str):
yaml_path = str(Path(f"{folder_path}") / "*.yaml")
req_path = str(Path(f"{folder_path}") / "*.txt")
def get_all_files(folder_path, dataset) -> (str, str):
yaml_path = str(Path(f"{folder_path}") / f"*{dataset}*.yaml")
req_path = str(Path(f"{folder_path}") / f"*{dataset}*.txt")
return glob.glob(yaml_path)[0], glob.glob(req_path)[0]
@@ -191,7 +191,7 @@ def gen_and_save_md_table(metrics):
# function to run the all the models
@only_allow_defined_args
def run(times=1, models=None, exclude=False):
def run(times=1, models=None, dataset='Alpha360', exclude=False):
"""
Please be aware that this function can only work under Linux. MacOS and Windows will be supported in the future.
Any PR to enhance this method is highly welcomed.
@@ -204,6 +204,8 @@ def run(times=1, models=None, exclude=False):
determines the specific model or list of models to run or exclude.
exclude : boolean
determines whether the model being used is excluded or included.
dataset : str
determines the dataset to be used for each model.
Usage:
-------
@@ -217,13 +219,16 @@ def run(times=1, models=None, exclude=False):
# Case 2 - run specific models multiple times
python run_all_model.py 3 mlp
# Case 3 - run other models except those are given as arguments for multiple times
python run_all_model.py 3 [mlp,tft,lstm] True
# Case 3 - run specific models multiple times with specific dataset
python run_all_model.py 3 mlp Alpha158
# Case 4 - run specific models for one time
# Case 4 - run other models except those are given as arguments for multiple times
python run_all_model.py 3 [mlp,tft,lstm] --exclude=True
# Case 5 - run specific models for one time
python run_all_model.py --models=[mlp,lightgbm]
# Case 5 - run other models except those are given as aruments for one time
# Case 6 - run other models except those are given as aruments for one time
python run_all_model.py --models=[mlp,tft,sfm] --exclude=True
"""
@@ -237,7 +242,7 @@ def run(times=1, models=None, exclude=False):
env_path, python_path, conda_activate = create_env()
# get all files
sys.stderr.write("Retrieving files...\n")
yaml_path, req_path = get_all_files(folders[fn])
yaml_path, req_path = get_all_files(folders[fn], dataset)
sys.stderr.write("\n")
# install requirements.txt
sys.stderr.write("Installing requirements.txt...\n")
@@ -291,7 +296,8 @@ def run(times=1, models=None, exclude=False):
pprint(errors)
sys.stderr.write("\n")
# move results folder
shutil.move(exp_path, exp_path + f"_{datetime.now().strftime('%Y-%m-%d_%H:%M:%S')}")
shutil.move(exp_path, exp_path + f"_{dataset}_{datetime.now().strftime('%Y-%m-%d_%H:%M:%S')}")
shutil.move("table.md", f"table_{dataset}_{datetime.now().strftime('%Y-%m-%d_%H:%M:%S')}.md")
if __name__ == "__main__":

View File

@@ -2,7 +2,7 @@
# Licensed under the MIT License.
__version__ = "0.6.0"
__version__ = "0.6.0.dev"
import os

View File

@@ -1,25 +0,0 @@
requests==2.22.0
six==1.14.0
lxml==4.5.0
statsmodels==0.12.0
pandas==1.1.2
matplotlib==3.3.2
scipy==1.3.3
numpy==1.17.4
Cython==0.29.21
fire==0.3.1
gevent_socketio==0.3.6
hyperopt==0.2.4
lightgbm==3.0.0
loguru==0.5.3
plotly==4.10.0
pymongo==3.11.0
PyYAML==5.3.1
redis==3.5.3
redis_lock==0.2.0
sacred==0.8.1
scikit_learn==0.23.2
torch==1.6.0
tqdm==4.49.0
yahooquery==2.2.7
mlflow==1.12.1

View File

@@ -11,7 +11,7 @@ NAME = "pyqlib"
DESCRIPTION = "A Quantitative-research Platform"
REQUIRES_PYTHON = ">=3.5.0"
VERSION = "0.6.0"
VERSION = "0.6.0.dev"
# Detect Cython
try: