From 3966075565b626f3f6c5358a5678ded1b6f7310c Mon Sep 17 00:00:00 2001 From: Quentin Date: Wed, 2 Jul 2025 14:10:26 +0200 Subject: [PATCH 1/4] modifying benchmarks --- examples/plot_benchmark_custom.py | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/examples/plot_benchmark_custom.py b/examples/plot_benchmark_custom.py index 866825d..b5e4926 100644 --- a/examples/plot_benchmark_custom.py +++ b/examples/plot_benchmark_custom.py @@ -184,16 +184,29 @@ def benchmark_radius_clustering(): fig.suptitle("Benchmark of Radius Clustering Solvers", fontsize=16) axs['time'].set_yscale('log') # Use logarithmic scale for better visibility -for algo, algo_results in results.items(): +#for algo, algo_results in results.items(): # Plot execution time - axs['time'].plot( - DATASETS.keys(), - algo_results["time"], - marker='o', - label=algo, - ) +# axs['time'].plot( +# DATASETS.keys(), +# algo_results["time"], +# marker='o', +# label=algo, +# ) # Plot number of clusters +algorithms = list(results.keys()) +dataset_names = list(DATASETS.keys()) +n_algos = len(algorithms) +x_indices = np.arange(len(dataset_names)) # the label locations +bar_width = 0.8 / n_algos # the width of the bars, with some padding + +for i, algo in enumerate(algorithms): + times = results[algo]["time"] + # Calculate position for each bar in the group to center them + position = x_indices - (n_algos * bar_width / 2) + (i * bar_width) + bar_width / 2 + axs['time'].bar(position, times, bar_width, label=algo) +# --- End of change --- + for i, (name, (dataset, _)) in enumerate(DATASETS.items()): axs[name].bar( results.keys(), @@ -207,7 +220,6 @@ def benchmark_radius_clustering(): linestyle='--', ) axs[name].set_title(name) - axs[name].set_xlabel("Algorithms") axs["iris"].set_ylabel("Number of clusters") axs["glass"].set_ylabel("Number of clusters") @@ -215,6 +227,8 @@ def benchmark_radius_clustering(): axs['time'].set_title("Execution Time (log scale)") axs['time'].set_xlabel("Datasets") axs['time'].set_ylabel("Time (seconds)") +axs['time'].set_xticks(x_indices) # Set tick positions to be at the center of the groups +axs['time'].set_xticklabels(dataset_names) axs['time'].legend(title="Algorithms") plt.tight_layout() plt.show() From b7aa96c55616ef4f64c3f3d557c83af69088c5c6 Mon Sep 17 00:00:00 2001 From: Quentin Date: Wed, 2 Jul 2025 14:18:59 +0200 Subject: [PATCH 2/4] better comments in doc examples --- examples/plot_benchmark_custom.py | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/examples/plot_benchmark_custom.py b/examples/plot_benchmark_custom.py index b5e4926..074e7a0 100644 --- a/examples/plot_benchmark_custom.py +++ b/examples/plot_benchmark_custom.py @@ -184,15 +184,6 @@ def benchmark_radius_clustering(): fig.suptitle("Benchmark of Radius Clustering Solvers", fontsize=16) axs['time'].set_yscale('log') # Use logarithmic scale for better visibility -#for algo, algo_results in results.items(): - # Plot execution time -# axs['time'].plot( -# DATASETS.keys(), -# algo_results["time"], -# marker='o', -# label=algo, -# ) - # Plot number of clusters algorithms = list(results.keys()) dataset_names = list(DATASETS.keys()) @@ -205,7 +196,6 @@ def benchmark_radius_clustering(): # Calculate position for each bar in the group to center them position = x_indices - (n_algos * bar_width / 2) + (i * bar_width) + bar_width / 2 axs['time'].bar(position, times, bar_width, label=algo) -# --- End of change --- for i, (name, (dataset, _)) in enumerate(DATASETS.items()): axs[name].bar( @@ -227,7 +217,7 @@ def benchmark_radius_clustering(): axs['time'].set_title("Execution Time (log scale)") axs['time'].set_xlabel("Datasets") axs['time'].set_ylabel("Time (seconds)") -axs['time'].set_xticks(x_indices) # Set tick positions to be at the center of the groups +axs['time'].set_xticks(x_indices) axs['time'].set_xticklabels(dataset_names) axs['time'].legend(title="Algorithms") plt.tight_layout() From 1e2c408e1aefdd57977d48a0b9928c3707df9661 Mon Sep 17 00:00:00 2001 From: Quentin Date: Wed, 2 Jul 2025 14:29:00 +0200 Subject: [PATCH 3/4] update check_estimator to parametrize_with_checks in structural tests --- .coverage | Bin 53248 -> 53248 bytes tests/test_structural.py | 19 +++++++++---------- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/.coverage b/.coverage index 4e3173d80d125ac231e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Ox$#y%Z2-$d(G{4``ll+@50aA zUbhPKHqG7Xu6LW=74Cd@wCiBl{t5%|XE*|fU!1;XRtR&U0H#2Oll*r`asGQa z^PQuq7`K7nuEMyH7u}ShPcPPu#I1A4KI5D$@`7=87WuJpRyKLwI3tJbHBQeU&l#ts zlOGw&H1aIqd*QD|k|fUr4C0cMAV1`2{4oWgBR|mhW9i5q}|6HyZ5*q z7{0A`VEMM(Hi|Zz5wvd;PZ^3U{u8i%8-s5tgdcXy-v)CVEf~DM-VW^FV|HKwd+fjh zt}`P@V7D0*8`xzBMzGV2L9AfM{~rlgHoK{_8W#&*s$w{-X3Z`j#A!?3G&x?yM6eTMCw(+qptry92P+^gu*P(yTz zIc_~T*|4Q`l3{bpM8l@$35N9z;|=TT#~DWJ#v0Z}$5=MqV^|X&Z5RoU0$+dEmEpV1 zado)Bu&O%WFj94wVP#~bVK_3vvNF%`U~R5pxb05Ein8H`Q eX_!}1%fFkM?x@@E`l;rTq_V^dSWR diff --git a/tests/test_structural.py b/tests/test_structural.py index 1401eac..f081803 100644 --- a/tests/test_structural.py +++ b/tests/test_structural.py @@ -1,8 +1,4 @@ -from logging import getLogger - -logger = getLogger(__name__) -logger.setLevel("INFO") - +from sklearn.utils.estimator_checks import parametrize_with_checks def test_import(): import radius_clustering as rad @@ -10,9 +6,12 @@ def test_import(): def test_from_import(): from radius_clustering import RadiusClustering -def test_check_estimator_api_consistency(): - from radius_clustering import RadiusClustering - from sklearn.utils.estimator_checks import check_estimator - # Check the API consistency of the RadiusClustering estimator - check_estimator(RadiusClustering()) +from radius_clustering import RadiusClustering + +@parametrize_with_checks([RadiusClustering()]) +def test_check_estimator_api_consistency(estimator, check, request): + + """Check the API consistency of the RadiusClustering estimator + """ + check(estimator) From 7e3cb1de47ab42d9c219e01f4b8a3b53cd966cb4 Mon Sep 17 00:00:00 2001 From: Quentin Date: Wed, 2 Jul 2025 14:32:16 +0200 Subject: [PATCH 4/4] updated minor version to reflect test suite changes --- src/radius_clustering/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/radius_clustering/__init__.py b/src/radius_clustering/__init__.py index 57c5d53..7ce571b 100644 --- a/src/radius_clustering/__init__.py +++ b/src/radius_clustering/__init__.py @@ -2,4 +2,4 @@ from .radius_clustering import RadiusClustering __all__ = ["RadiusClustering"] -__version__ = "1.4.0" +__version__ = "1.4.1"