From f237a344c34e7e7a27735c4754c9a0589947dbd9 Mon Sep 17 00:00:00 2001 From: Jactus Date: Fri, 4 Dec 2020 10:31:50 +0800 Subject: [PATCH] Update --- examples/run_all_model.py | 26 ++++++++++++++++---------- qlib/__init__.py | 2 +- requirements.txt | 25 ------------------------- setup.py | 2 +- 4 files changed, 18 insertions(+), 37 deletions(-) delete mode 100644 requirements.txt diff --git a/examples/run_all_model.py b/examples/run_all_model.py index 416f1b47f..9cc1bd2d6 100644 --- a/examples/run_all_model.py +++ b/examples/run_all_model.py @@ -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__": diff --git a/qlib/__init__.py b/qlib/__init__.py index e84e48ce8..f79b8c4f5 100644 --- a/qlib/__init__.py +++ b/qlib/__init__.py @@ -2,7 +2,7 @@ # Licensed under the MIT License. -__version__ = "0.6.0" +__version__ = "0.6.0.dev" import os diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index 638ce22f4..000000000 --- a/requirements.txt +++ /dev/null @@ -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 \ No newline at end of file diff --git a/setup.py b/setup.py index 0cb23f771..cc495824e 100644 --- a/setup.py +++ b/setup.py @@ -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: