pheval 0.5.4__py3-none-any.whl → 0.5.6__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of pheval might be problematic. Click here for more details.
- pheval/analyse/rank_stats.py +13 -37
- {pheval-0.5.4.dist-info → pheval-0.5.6.dist-info}/METADATA +1 -1
- {pheval-0.5.4.dist-info → pheval-0.5.6.dist-info}/RECORD +6 -6
- {pheval-0.5.4.dist-info → pheval-0.5.6.dist-info}/WHEEL +1 -1
- {pheval-0.5.4.dist-info → pheval-0.5.6.dist-info}/LICENSE +0 -0
- {pheval-0.5.4.dist-info → pheval-0.5.6.dist-info}/entry_points.txt +0 -0
pheval/analyse/rank_stats.py
CHANGED
|
@@ -124,24 +124,11 @@ class Ranks:
|
|
|
124
124
|
return np.mean(precision_at_k)
|
|
125
125
|
|
|
126
126
|
@classmethod
|
|
127
|
-
def mean_average_precision_at_k(cls, df: pl.LazyFrame, k: int) ->
|
|
128
|
-
"""
|
|
129
|
-
Compute Mean Average Precision at K (MAP@K) by averaging AP@K scores.
|
|
130
|
-
Args:
|
|
131
|
-
df (pl.LazyFrame): The dataframe calculate MAP@K for each query.
|
|
132
|
-
k (int): The upper rank limit.
|
|
133
|
-
Returns:
|
|
134
|
-
pl.LazyFrame: The dataframe with MAP@K for each query.
|
|
135
|
-
"""
|
|
127
|
+
def mean_average_precision_at_k(cls, df: pl.LazyFrame, k: int) -> float:
|
|
136
128
|
ap_at_k_df = cls._average_precision_at_k(df, k)
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
)
|
|
141
|
-
.fill_null(0.0)
|
|
142
|
-
.collect()
|
|
143
|
-
.item()
|
|
144
|
-
)
|
|
129
|
+
ap_sum = ap_at_k_df.select(pl.col(f"ap@{k}").sum()).collect().item()
|
|
130
|
+
num_samples = df.select(Ranks.NUMBER_OF_SAMPLES).collect().item()
|
|
131
|
+
return ap_sum / num_samples
|
|
145
132
|
|
|
146
133
|
@classmethod
|
|
147
134
|
def _calculate_ndcg_at_k(cls, ranks: List[int], k: int) -> float:
|
|
@@ -165,29 +152,18 @@ class Ranks:
|
|
|
165
152
|
)
|
|
166
153
|
|
|
167
154
|
@classmethod
|
|
168
|
-
def mean_normalised_discounted_cumulative_gain(cls, df: pl.LazyFrame, k: int) ->
|
|
169
|
-
"""
|
|
170
|
-
Compute mean normalised discounted cumulative gain.
|
|
171
|
-
Args:
|
|
172
|
-
df (pl.LazyFrame): The dataframe to calculate mean normalised cumulative gain.
|
|
173
|
-
k (int): The upper rank limit.
|
|
174
|
-
Returns:
|
|
175
|
-
pl.LazyFrame: The dataframe with mean normalised cumulative gain.
|
|
176
|
-
"""
|
|
155
|
+
def mean_normalised_discounted_cumulative_gain(cls, df: pl.LazyFrame, k: int) -> float:
|
|
177
156
|
filtered_df = cls._filter_results(df, k)
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
.
|
|
182
|
-
lambda row: cls._calculate_ndcg_at_k(row["ranks"], k), return_dtype=pl.Float64
|
|
183
|
-
)
|
|
184
|
-
.alias(f"NDCG@{k}")
|
|
157
|
+
ndcg_df = filtered_df.with_columns(
|
|
158
|
+
pl.struct("ranks")
|
|
159
|
+
.map_elements(
|
|
160
|
+
lambda row: cls._calculate_ndcg_at_k(row["ranks"], k), return_dtype=pl.Float64
|
|
185
161
|
)
|
|
186
|
-
.
|
|
187
|
-
.fill_null(0.0)
|
|
188
|
-
.collect()
|
|
189
|
-
.item()
|
|
162
|
+
.alias(f"NDCG@{k}")
|
|
190
163
|
)
|
|
164
|
+
ndcg_sum = ndcg_df.select(pl.col(f"NDCG@{k}").sum()).collect().item()
|
|
165
|
+
num_samples = df.select(Ranks.NUMBER_OF_SAMPLES).collect().item()
|
|
166
|
+
return ndcg_sum / num_samples
|
|
191
167
|
|
|
192
168
|
|
|
193
169
|
def compute_rank_stats(run_identifier: str, result_scan: pl.LazyFrame) -> pl.LazyFrame:
|
|
@@ -7,7 +7,7 @@ pheval/analyse/binary_classification_curves.py,sha256=Crb45rJWc5rxDdx82sgoHRvYHE
|
|
|
7
7
|
pheval/analyse/binary_classification_stats.py,sha256=sOuEp6IxZ6SVp-KC6MJkZNTkZucZTNK25xApP5tU6Mk,6944
|
|
8
8
|
pheval/analyse/generate_plots.py,sha256=g98DxhTw1dPRfRRYoKBmt51XfIa2KzlL_Z7weFSoBUg,14550
|
|
9
9
|
pheval/analyse/generate_rank_comparisons.py,sha256=KcQJ9rm1nvvTcqLNuxAkXRXuV18vEsiP0giQ-ryHyYc,1684
|
|
10
|
-
pheval/analyse/rank_stats.py,sha256=
|
|
10
|
+
pheval/analyse/rank_stats.py,sha256=JLgbaumayUzVzpRh0IXlY7454HWShVJQVImifC0U4GA,8489
|
|
11
11
|
pheval/analyse/run_data_parser.py,sha256=Lr0ao_Mlp8EYLaM4XmiEjo7P7jt_rCBR2y2hb_D3c70,3366
|
|
12
12
|
pheval/cli.py,sha256=rpvTTCKAvH75XkZUh0xaKv7Ftl9zIt2RncsMGIlrq9U,1556
|
|
13
13
|
pheval/cli_pheval.py,sha256=iVvPby44EvVHkZsOFNQ_DovhYdwIkKir1Kf8uVJ_GCw,2872
|
|
@@ -46,8 +46,8 @@ pheval/utils/logger.py,sha256=5DZl5uMltUDQorhkvg_B7_ZhFwApAmEkWneFIOKfRGQ,1566
|
|
|
46
46
|
pheval/utils/phenopacket_utils.py,sha256=XGnFLarvXezFR0W5frzyGTwEbhcA3zuGJPg1r5YBscg,27326
|
|
47
47
|
pheval/utils/semsim_utils.py,sha256=s7ZCR2VfPYnOh7ApX6rv66eGoVSm9QJaVYOWBEhlXpo,6151
|
|
48
48
|
pheval/utils/utils.py,sha256=9V6vCT8l1g4O2-ZATYqsVyd7AYZdWGd-Ksy7_oIC3eE,2343
|
|
49
|
-
pheval-0.5.
|
|
50
|
-
pheval-0.5.
|
|
51
|
-
pheval-0.5.
|
|
52
|
-
pheval-0.5.
|
|
53
|
-
pheval-0.5.
|
|
49
|
+
pheval-0.5.6.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
50
|
+
pheval-0.5.6.dist-info/METADATA,sha256=HF7334A4_vsT4xMmQNLel8C_GmnlRooXl8RzZZQCj24,6494
|
|
51
|
+
pheval-0.5.6.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
|
|
52
|
+
pheval-0.5.6.dist-info/entry_points.txt,sha256=o9gSwDkvT4-lqKy4mlsftd1nzP9WUOXQCfnbqycURd0,81
|
|
53
|
+
pheval-0.5.6.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|