From 82327c7194ea5768a59a14f1be572c75a4f16c3d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrik=20=C4=90ur=C4=91evi=C4=87?= Date: Mon, 31 Jul 2023 10:47:23 -0400 Subject: [PATCH 1/2] Rename _execute_operations_on_df to target --- tests/integration_tests/utils.py | 4 ++-- tests/test_prediction_problem.py | 2 +- trane/core/prediction_problem.py | 1 + 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/tests/integration_tests/utils.py b/tests/integration_tests/utils.py index 8010535..4f5f57e 100644 --- a/tests/integration_tests/utils.py +++ b/tests/integration_tests/utils.py @@ -103,7 +103,7 @@ def generate_and_verify_prediction_problem( if not use_multiprocess: label_times = p.execute(df, -1) assert label_times.target_dataframe_index == entity_col - # TODO: fix bug with Filter Operation results in labels that has _execute_operations_on_df == 0 + # TODO: fix bug with Filter Operation results in labels that has target == 0 # Below is not an ideal way to check the prediction problems # (because it has less than, rather than exact number of unique instances) if not label_times.empty: @@ -120,7 +120,7 @@ def generate_and_verify_prediction_problem( def check_label_times(label_times, entity_col, unique_entity_ids): assert label_times.target_dataframe_index == entity_col - # TODO: fix bug with Filter Operation results in labels that has _execute_operations_on_df == 0 + # TODO: fix bug with Filter Operation results in labels that has target == 0 # Below is not an ideal way to check the prediction problems # (because it has less than, rather than exact number of unique instances) if not label_times.empty: diff --git a/tests/test_prediction_problem.py b/tests/test_prediction_problem.py index 8eba5ac..c81bfde 100644 --- a/tests/test_prediction_problem.py +++ b/tests/test_prediction_problem.py @@ -107,7 +107,7 @@ def verify_problems(problems, df, cutoff_strategy): problems = sorted(problems) for p in problems: label_times = p.execute(df, -1) - label_times.rename(columns={"_execute_operations_on_df": "label"}, inplace=True) + label_times.rename(columns={"target": "label"}, inplace=True) threshold = p.operations[0].threshold if str(p) == "For each predict the number of records in next 2d days": diff --git a/trane/core/prediction_problem.py b/trane/core/prediction_problem.py index aa5079c..e9d8fb5 100755 --- a/trane/core/prediction_problem.py +++ b/trane/core/prediction_problem.py @@ -159,6 +159,7 @@ def execute( ) if "__identity__" in df.columns: df.drop(columns=["__identity__"], inplace=True) + lt = lt.rename(columns={"_execute_operations_on_df": "target"}) return lt def _execute_operations_on_df(self, df: pd.DataFrame): From c67138e1f49343ce441b01e77f73f09d5a48e075 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrik=20=C4=90ur=C4=91evi=C4=87?= Date: Mon, 31 Jul 2023 10:50:36 -0400 Subject: [PATCH 2/2] Update changelog.md --- docs/changelog.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/changelog.md b/docs/changelog.md index 47cb5c7..4300a64 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -7,10 +7,12 @@ v0.6.0 (, 2023) =============== * Enhancements * Fixes + * Rename `_execute_operations_on_df` to `target` in executed prediction problem dataframe [#124][#124] * Clean up operation description generation [#118][#118] * Remove PredictionProblemEvaluator [#118][#118] * Remove FeaturetoolsWrapper class [#100][#100] + [#124]: [#118]: