From 33e1e97c6d524b0a33345714cc11477ceebf334b Mon Sep 17 00:00:00 2001 From: Markus Semmler Date: Wed, 1 May 2024 19:00:51 +0200 Subject: [PATCH] Adapt params for rank stability. --- params.yaml | 4 ++-- src/re_classwise_shapley/curve.py | 9 ++++++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/params.yaml b/params.yaml index 746c0a5f..7627439a 100644 --- a/params.yaml +++ b/params.yaml @@ -11,7 +11,7 @@ settings: sample_data: false calculate_values: false calculate_threshold_characteristics: false - evaluate_curves: false + evaluate_curves: true evaluate_metrics: true render_plots: true @@ -84,7 +84,7 @@ experiments: fn: top_fraction alpha_range: from: 0.01 - to: 0.05 + to: 0.5 step: 0.01 plots: - rank_stability diff --git a/src/re_classwise_shapley/curve.py b/src/re_classwise_shapley/curve.py index 26f5fbfe..5f1f397d 100644 --- a/src/re_classwise_shapley/curve.py +++ b/src/re_classwise_shapley/curve.py @@ -48,13 +48,16 @@ def curve_top_fraction( alpha_range: A dictionary containing from, to and step keys. Returns: - A pd.Series contianing the alpha value on the x-axis and a unfolded list on the + A pd.Series containing the alpha value on the x-axis and a unfolded list on the y-axis. """ assert -1 <= alpha_range["to"] <= 1.0 assert -1 <= alpha_range["from"] <= 1.0 - n = int((alpha_range["to"] - alpha_range["from"]) / alpha_range["step"]) + 1 - alpha_range = np.arange(alpha_range["from"], alpha_range["to"], alpha_range["step"]) + alpha_range = np.arange( + alpha_range["from"], + alpha_range["to"] + alpha_range["step"], + alpha_range["step"], + ) values.sort(reverse=np.all(alpha_range >= 0)) alpha_values = []