Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename _execute_operations_on_df to target #124

Merged
merged 2 commits into from
Jul 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -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]: <https://github.com/trane-dev/Trane/pull/124>
[#118]: <https://github.com/trane-dev/Trane/pull/118>


Expand Down
4 changes: 2 additions & 2 deletions tests/integration_tests/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion tests/test_prediction_problem.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 <id> predict the number of records in next 2d days":
Expand Down
1 change: 1 addition & 0 deletions trane/core/prediction_problem.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down