diff --git a/.coverage b/.coverage index 4e3173d..1f404fc 100644 Binary files a/.coverage and b/.coverage differ diff --git a/examples/plot_benchmark_custom.py b/examples/plot_benchmark_custom.py index 866825d..074e7a0 100644 --- a/examples/plot_benchmark_custom.py +++ b/examples/plot_benchmark_custom.py @@ -184,15 +184,18 @@ 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()) +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) for i, (name, (dataset, _)) in enumerate(DATASETS.items()): axs[name].bar( @@ -207,7 +210,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 +217,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) +axs['time'].set_xticklabels(dataset_names) axs['time'].legend(title="Algorithms") plt.tight_layout() plt.show() 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" 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)