mirror of
https://github.com/microsoft/qlib.git
synced 2026-07-17 01:14:35 +08:00
Update
This commit is contained in:
@@ -135,9 +135,9 @@ def get_all_folders(models, exclude) -> dict:
|
|||||||
|
|
||||||
|
|
||||||
# function to get all the files under the model folder
|
# function to get all the files under the model folder
|
||||||
def get_all_files(folder_path) -> (str, str):
|
def get_all_files(folder_path, dataset) -> (str, str):
|
||||||
yaml_path = str(Path(f"{folder_path}") / "*.yaml")
|
yaml_path = str(Path(f"{folder_path}") / f"*{dataset}*.yaml")
|
||||||
req_path = str(Path(f"{folder_path}") / "*.txt")
|
req_path = str(Path(f"{folder_path}") / f"*{dataset}*.txt")
|
||||||
return glob.glob(yaml_path)[0], glob.glob(req_path)[0]
|
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
|
# function to run the all the models
|
||||||
@only_allow_defined_args
|
@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.
|
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.
|
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.
|
determines the specific model or list of models to run or exclude.
|
||||||
exclude : boolean
|
exclude : boolean
|
||||||
determines whether the model being used is excluded or included.
|
determines whether the model being used is excluded or included.
|
||||||
|
dataset : str
|
||||||
|
determines the dataset to be used for each model.
|
||||||
|
|
||||||
Usage:
|
Usage:
|
||||||
-------
|
-------
|
||||||
@@ -217,13 +219,16 @@ def run(times=1, models=None, exclude=False):
|
|||||||
# Case 2 - run specific models multiple times
|
# Case 2 - run specific models multiple times
|
||||||
python run_all_model.py 3 mlp
|
python run_all_model.py 3 mlp
|
||||||
|
|
||||||
# Case 3 - run other models except those are given as arguments for multiple times
|
# Case 3 - run specific models multiple times with specific dataset
|
||||||
python run_all_model.py 3 [mlp,tft,lstm] True
|
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]
|
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
|
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()
|
env_path, python_path, conda_activate = create_env()
|
||||||
# get all files
|
# get all files
|
||||||
sys.stderr.write("Retrieving files...\n")
|
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")
|
sys.stderr.write("\n")
|
||||||
# install requirements.txt
|
# install requirements.txt
|
||||||
sys.stderr.write("Installing requirements.txt...\n")
|
sys.stderr.write("Installing requirements.txt...\n")
|
||||||
@@ -291,7 +296,8 @@ def run(times=1, models=None, exclude=False):
|
|||||||
pprint(errors)
|
pprint(errors)
|
||||||
sys.stderr.write("\n")
|
sys.stderr.write("\n")
|
||||||
# move results folder
|
# 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__":
|
if __name__ == "__main__":
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
# Licensed under the MIT License.
|
# Licensed under the MIT License.
|
||||||
|
|
||||||
|
|
||||||
__version__ = "0.6.0"
|
__version__ = "0.6.0.dev"
|
||||||
|
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
|||||||
@@ -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
|
|
||||||
Reference in New Issue
Block a user