Skip to content

26 rebase the test suit on scikit learn guidelines #27

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified .coverage
Binary file not shown.
24 changes: 14 additions & 10 deletions examples/plot_benchmark_custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -207,14 +210,15 @@ 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")

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()
Expand Down
2 changes: 1 addition & 1 deletion src/radius_clustering/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
from .radius_clustering import RadiusClustering

__all__ = ["RadiusClustering"]
__version__ = "1.4.0"
__version__ = "1.4.1"
19 changes: 9 additions & 10 deletions tests/test_structural.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
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


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)