Skip to content

Commit

Permalink
remove feature_configs for drop features
Browse files Browse the repository at this point in the history
  • Loading branch information
wwxxzz committed Oct 20, 2023
1 parent e18caf0 commit 0108c22
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
6 changes: 3 additions & 3 deletions easy_rec/python/tools/add_feature_info_to_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ def main(argv):
except common_io.exception.OutOfRangeException:
reader.close()
break

for feature_config in config_util.get_compatible_feature_configs(
pipeline_config):
feature_configs = config_util.get_compatible_feature_configs(pipeline_config, drop_feature_names)
for feature_config in feature_configs:
feature_name = feature_config.input_names[0]
if feature_name in feature_info_map:
logging.info('edited %s' % feature_name)
Expand Down
9 changes: 7 additions & 2 deletions easy_rec/python/utils/config_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -390,14 +390,19 @@ def add_boundaries_to_config(pipeline_config, tables):
logging.info('edited %s' % feature_name)


def get_compatible_feature_configs(pipeline_config):
def get_compatible_feature_configs(pipeline_config,drop_feature_names=None):
if pipeline_config.feature_configs:
feature_configs = pipeline_config.feature_configs
else:
feature_configs = pipeline_config.feature_config.features
if drop_feature_names:
tmp_feature_configs = feature_configs[:]
for fea_cfg in tmp_feature_configs:
fea_name = fea_cfg.input_names[0]
if fea_name in drop_feature_names:
feature_configs.remove(fea_cfg)
return feature_configs


def parse_time(time_data):
"""Parse time string to timestamp.
Expand Down

0 comments on commit 0108c22

Please sign in to comment.