mirror of
https://github.com/microsoft/qlib.git
synced 2026-07-15 16:56:54 +08:00
add ops_warning_log to config (#685)
This commit is contained in:
@@ -40,13 +40,13 @@ if __name__ == "__main__":
|
|||||||
# 3) create new task with handler cache
|
# 3) create new task with handler cache
|
||||||
new_task_config = deepcopy(task_config)
|
new_task_config = deepcopy(task_config)
|
||||||
new_task_config["task"]["dataset"]["kwargs"]["handler"] = f"file://{hd_path}"
|
new_task_config["task"]["dataset"]["kwargs"]["handler"] = f"file://{hd_path}"
|
||||||
new_task_config
|
new_task_config["sys"] = {"path": [str(config_path.parent.resolve())]}
|
||||||
new_task_path = DIRNAME / "new_task.yaml"
|
new_task_path = DIRNAME / "new_task.yaml"
|
||||||
print("The location of the new task", new_task_path)
|
print("The location of the new task", new_task_path)
|
||||||
|
|
||||||
# save new task
|
# save new task
|
||||||
with new_task_path.open("w") as f:
|
with new_task_path.open("w") as f:
|
||||||
yaml.safe_dump(new_task_config, f)
|
yaml.safe_dump(new_task_config, f, indent=4, sort_keys=False)
|
||||||
|
|
||||||
# 4) train model with new task
|
# 4) train model with new task
|
||||||
with TimeInspector.logt("The time for task with handler cache:"):
|
with TimeInspector.logt("The time for task with handler cache:"):
|
||||||
|
|||||||
@@ -176,6 +176,8 @@ _default_config = {
|
|||||||
# if min_data_shift == 0, use default market time [9:30, 11:29, 1:00, 2:59]
|
# if min_data_shift == 0, use default market time [9:30, 11:29, 1:00, 2:59]
|
||||||
# if min_data_shift != 0, use shifted market time [9:30, 11:29, 1:00, 2:59] - shift*minute
|
# if min_data_shift != 0, use shifted market time [9:30, 11:29, 1:00, 2:59] - shift*minute
|
||||||
"min_data_shift": 0,
|
"min_data_shift": 0,
|
||||||
|
# whether to display the ops warning log, default False
|
||||||
|
"ops_warning_log": False,
|
||||||
}
|
}
|
||||||
|
|
||||||
MODE_CONF = {
|
MODE_CONF = {
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ from ..utils import (
|
|||||||
hash_args,
|
hash_args,
|
||||||
normalize_cache_fields,
|
normalize_cache_fields,
|
||||||
code_to_fname,
|
code_to_fname,
|
||||||
|
set_log_with_config,
|
||||||
)
|
)
|
||||||
from ..utils.paral import ParallelExt
|
from ..utils.paral import ParallelExt
|
||||||
|
|
||||||
@@ -586,6 +587,8 @@ class DatasetProvider(abc.ABC):
|
|||||||
# NOTE: This place is compatible with windows, windows multi-process is spawn
|
# NOTE: This place is compatible with windows, windows multi-process is spawn
|
||||||
if not C.registered:
|
if not C.registered:
|
||||||
C.set_conf_from_C(g_config)
|
C.set_conf_from_C(g_config)
|
||||||
|
if C.logging_config:
|
||||||
|
set_log_with_config(C.logging_config)
|
||||||
C.register()
|
C.register()
|
||||||
|
|
||||||
obj = dict()
|
obj = dict()
|
||||||
|
|||||||
@@ -14,6 +14,8 @@ from typing import Union, List, Type
|
|||||||
from scipy.stats import percentileofscore
|
from scipy.stats import percentileofscore
|
||||||
|
|
||||||
from .base import Expression, ExpressionOps, Feature
|
from .base import Expression, ExpressionOps, Feature
|
||||||
|
|
||||||
|
from ..config import C
|
||||||
from ..log import get_module_logger
|
from ..log import get_module_logger
|
||||||
from ..utils import get_callable_kwargs
|
from ..utils import get_callable_kwargs
|
||||||
|
|
||||||
@@ -325,7 +327,7 @@ class NpPairOperator(PairOperator):
|
|||||||
get_module_logger("ops").error(warning_info)
|
get_module_logger("ops").error(warning_info)
|
||||||
raise ValueError(f"{str(e)}. \n\t{warning_info}")
|
raise ValueError(f"{str(e)}. \n\t{warning_info}")
|
||||||
else:
|
else:
|
||||||
if check_length and len(series_left) != len(series_right):
|
if check_length and len(series_left) != len(series_right) and C.ops_warning_log:
|
||||||
get_module_logger("ops").warning(warning_info)
|
get_module_logger("ops").warning(warning_info)
|
||||||
return res
|
return res
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user