1
0
mirror of https://github.com/microsoft/qlib.git synced 2026-06-06 05:51:17 +08:00

rename group -> fields_group

This commit is contained in:
Young
2020-11-24 02:05:05 +00:00
parent f536241a5f
commit 0112d06ed5
3 changed files with 9 additions and 8 deletions

View File

@@ -182,7 +182,7 @@ def _mount_nfs_uri(C):
LOG.warning(f"{_remote_uri} on {_mount_path} is already mounted")
def init_from_yaml_conf(conf_path):
def init_from_yaml_conf(conf_path, **kwargs):
"""init_from_yaml_conf
:param conf_path: A path to the qlib config in yml format
@@ -190,5 +190,6 @@ def init_from_yaml_conf(conf_path):
with open(conf_path) as f:
config = yaml.load(f, Loader=yaml.FullLoader)
config.update(kwargs)
default_conf = config.pop("default_conf", "client")
init(default_conf, **config)

View File

@@ -23,7 +23,7 @@ class ALPHA360_Denoise(DataHandlerLP):
}
learn_processors = [
{"class": "DropnaLabel", "kwargs": {"group": "label"}},
{"class": "DropnaLabel", "kwargs": {"fields_group": "label"}},
{"class": "CSZScoreNorm", "kwargs": {"fields_group": "label"}},
]
infer_processors = [
@@ -96,7 +96,7 @@ class ALPHA360(DataHandlerLP):
}
learn_processors = [
{"class": "DropnaLabel", "kwargs": {"group": "label"}},
{"class": "DropnaLabel", "kwargs": {"fields_group": "label"}},
{"class": "CSZScoreNorm", "kwargs": {"fields_group": "label"}},
]
infer_processors = [

View File

@@ -74,16 +74,16 @@ class Processor(Serializable):
class DropnaProcessor(Processor):
def __init__(self, group=None):
self.group = group
def __init__(self, fields_group=None):
self.fields_group = fields_group
def __call__(self, df):
return df.dropna(subset=get_group_columns(df, self.group))
return df.dropna(subset=get_group_columns(df, self.fields_group))
class DropnaLabel(DropnaProcessor):
def __init__(self, group="label"):
super().__init__(group=group)
def __init__(self, fields_group="label"):
super().__init__(fields_group=fields_group)
def is_for_infer(self) -> bool:
"""The samples are dropped according to label. So it is not usable for inference"""