From 9e0ac776d5ab90681c445e8b579cff130616bfde Mon Sep 17 00:00:00 2001 From: kasun Date: Thu, 21 Dec 2023 21:04:08 +0000 Subject: [PATCH 1/2] add subsetters for interval and metric --- .../component/architect/feature_group_creator.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/triage/component/architect/feature_group_creator.py b/src/triage/component/architect/feature_group_creator.py index b1c7cd86e..dfb747f10 100644 --- a/src/triage/component/architect/feature_group_creator.py +++ b/src/triage/component/architect/feature_group_creator.py @@ -37,6 +37,20 @@ def prefix_subsetter(config_item, table, features): "Return features matching a given prefix" return [feature for feature in features if feature.startswith(config_item)] + +def metric_subsetter(config_item, table, features): + "Return features that implements the given metric" + # The metric is represented at the end of the feature name + return [feature for feature in features if feature.endwith("_"+config_item)] + + +def interval_subsetter(config_item, table, features): + "Return features that use data from a specific time interval" + + search_str = f"_{config_item}_" + return [feature for feature in features if search_str in feature] + + def all_subsetter(config_item, table, features): return features @@ -47,6 +61,8 @@ class FeatureGroupCreator: subsetters = { "tables": table_subsetter, "prefix": prefix_subsetter, + "metric": metric_subsetter, + "interval": interval_subsetter, "all": all_subsetter } From 0e98dc44805e03162a23e97614af29ff907eac03 Mon Sep 17 00:00:00 2001 From: kasun Date: Fri, 22 Dec 2023 16:38:17 +0000 Subject: [PATCH 2/2] debug --- src/triage/component/architect/feature_group_creator.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/triage/component/architect/feature_group_creator.py b/src/triage/component/architect/feature_group_creator.py index dfb747f10..bedbb107b 100644 --- a/src/triage/component/architect/feature_group_creator.py +++ b/src/triage/component/architect/feature_group_creator.py @@ -41,7 +41,7 @@ def prefix_subsetter(config_item, table, features): def metric_subsetter(config_item, table, features): "Return features that implements the given metric" # The metric is represented at the end of the feature name - return [feature for feature in features if feature.endwith("_"+config_item)] + return [feature for feature in features if feature.endswith("_"+config_item)] def interval_subsetter(config_item, table, features):