From 9ecd28996f2599b5b0818e6357882c2cbe692217 Mon Sep 17 00:00:00 2001 From: "Gzx@151" Date: Fri, 17 Jan 2025 14:31:42 +0800 Subject: [PATCH 1/2] add metric p90 --- bigvectorbench/plotting/metrics.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/bigvectorbench/plotting/metrics.py b/bigvectorbench/plotting/metrics.py index bda22c6..42a264d 100644 --- a/bigvectorbench/plotting/metrics.py +++ b/bigvectorbench/plotting/metrics.py @@ -68,6 +68,16 @@ def percentile_50(times): return np.percentile(times, 50.0) * 1000.0 +def percentile_90(times): + """ + 95th percentile + + :param times: list of query times + :return: 95th percentile in milliseconds + """ + return np.percentile(times, 90.0) * 1000.0 + + def percentile_95(times): """ 95th percentile @@ -164,6 +174,13 @@ def candidates(attrs): ), "worst": float("inf"), }, + "p90": { + "description": "Percentile 50 (millis)", + "function": lambda true_neighbors, run_neighbors, metrics, times, run_attrs: percentile_90( + times + ), + "worst": float("inf"), + }, "p95": { "description": "Percentile 95 (millis)", "function": lambda true_neighbors, run_neighbors, metrics, times, run_attrs: percentile_95( From 6c22f8ad3ecdb793d2417a410307d8a7cc304066 Mon Sep 17 00:00:00 2001 From: "Gzx@151" Date: Fri, 17 Jan 2025 14:35:00 +0800 Subject: [PATCH 2/2] add avg times --- bigvectorbench/plotting/metrics.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/bigvectorbench/plotting/metrics.py b/bigvectorbench/plotting/metrics.py index 42a264d..d047900 100644 --- a/bigvectorbench/plotting/metrics.py +++ b/bigvectorbench/plotting/metrics.py @@ -167,6 +167,14 @@ def candidates(attrs): ), "worst": float("-inf"), }, + "avg_time": { + "description": "Average time (millis)", + "function": lambda true_neighbors, run_neighbors, metrics, times, run_attrs: np.mean( + times + ) + * 1000.0, + "worst": float("inf"), + }, "p50": { "description": "Percentile 50 (millis)", "function": lambda true_neighbors, run_neighbors, metrics, times, run_attrs: percentile_50(