Skip to content

Commit

Permalink
correctly group threshold metrics by outer fold iteration.
Browse files Browse the repository at this point in the history
  • Loading branch information
ccdavis committed Dec 3, 2024
1 parent fdd402c commit 3500e7c
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions hlink/linking/model_exploration/link_step_train_test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,7 @@ def _evaluate_threshold_combinations(
f"{this_alpha_threshold=} and {this_threshold_ratio=}"
)
logger.debug(diag)
start_predict_time = perf_counter()
predictions = threshold_core.predict_using_thresholds(
thresholding_predictions,
this_alpha_threshold,
Expand All @@ -401,6 +402,10 @@ def _evaluate_threshold_combinations(
config["id_column"],
)

end_predict_time = perf_counter()
info = f"Predictions for test-train data on threshold took {end_predict_time - start_predict_time:.2f}s"
logger.debug(info)

results_dfs[i] = self._capture_results(
predictions,
predict_train,
Expand All @@ -413,14 +418,15 @@ def _evaluate_threshold_combinations(
best_results.score,
)

# for i in range(len(threshold_matrix)):
i += 1

for i in range(len(threshold_matrix)):
thresholded_metrics_df = _append_results(
thresholded_metrics_df,
results_dfs[i],
best_results.model_type,
best_results.hyperparams,
)
i += 1

thresholding_test_data.unpersist()
thresholding_training_data.unpersist()
Expand Down

0 comments on commit 3500e7c

Please sign in to comment.