mirror of
https://github.com/microsoft/qlib.git
synced 2026-06-06 05:51:17 +08:00
* update python version * fix: Correct selector handling and add time filtering in storage.py * fix: convert index and columns to list in repr methods * feat: Add Makefile for managing project prerequisites * feat: Add Cython extensions for rolling and expanding operations * resolve install error * fix lint error * fix lint error * fix lint error * fix lint error * fix lint error * update build package * update makefile * update ci yaml * fix docs build error * fix ubuntu install error * fix docs build error * fix install error * fix install error * fix install error * fix install error * fix pylint error * fix pylint error * fix pylint error * fix pylint error * fix pylint error E1123 * fix pylint error R0917 * fix pytest error * fix pytest error * fix pytest error * update code * update code * fix ci error * fix pylint error * fix black error * fix pytest error * fix CI error * fix CI error * add python version to CI * add python version to CI * add python version to CI * fix pylint error * fix pytest general nn error * fix CI error * optimize code * add coments * Extended macos version * remove build package --------- Co-authored-by: Young <afe.young@gmail.com>
39 lines
1.2 KiB
Python
39 lines
1.2 KiB
Python
import argparse
|
|
|
|
import qlib
|
|
from ruamel.yaml import YAML
|
|
from qlib.utils import init_instance_by_config
|
|
|
|
|
|
def main(seed, config_file="configs/config_alstm.yaml"):
|
|
# set random seed
|
|
with open(config_file) as f:
|
|
yaml = YAML(typ="safe", pure=True)
|
|
config = yaml.load(f)
|
|
|
|
# seed_suffix = "/seed1000" if "init" in config_file else f"/seed{seed}"
|
|
seed_suffix = ""
|
|
config["task"]["model"]["kwargs"].update(
|
|
{"seed": seed, "logdir": config["task"]["model"]["kwargs"]["logdir"] + seed_suffix}
|
|
)
|
|
|
|
# initialize workflow
|
|
qlib.init(
|
|
provider_uri=config["qlib_init"]["provider_uri"],
|
|
region=config["qlib_init"]["region"],
|
|
)
|
|
dataset = init_instance_by_config(config["task"]["dataset"])
|
|
model = init_instance_by_config(config["task"]["model"])
|
|
|
|
# train model
|
|
model.fit(dataset)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
# set params from cmd
|
|
parser = argparse.ArgumentParser(allow_abbrev=False)
|
|
parser.add_argument("--seed", type=int, default=1000, help="random seed")
|
|
parser.add_argument("--config_file", type=str, default="configs/config_alstm.yaml", help="config file")
|
|
args = parser.parse_args()
|
|
main(**vars(args))
|