Skip to content

Commit 85c0474

Browse files
authored
Merge pull request #20 from lias-laboratory/scikit-learn-contrib
scikit-learn-contrib application guidelines applied. New version 1.3.0.
2 parents bc3b081 + 134888c commit 85c0474

17 files changed

+521
-94
lines changed

.coverage

52 KB
Binary file not shown.

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ docs/build/
33

44
# env and caches
55

6-
mdsenv/
6+
mds-env/
77
**/__pycache__/
88
.pytest_cache/
99
.ruff_cache/
@@ -25,5 +25,8 @@ docs/source/modules/generated/
2525
**/emos.c
2626
**/mds.cpp
2727

28+
# MAC OS files
29+
.DS_Store
30+
2831
# Reportings
2932
reporting/

CHANGELOG.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Changelog
2+
3+
## [1.3.0] - 2025-06-18
4+
5+
### Added
6+
7+
- Full test coverage for the entire codebase.
8+
- Badge for test coverage in the README.
9+
- Added `radius` parameter to the `RadiusClustering` class, allowing users to specify the radius for clustering.
10+
11+
### Deprecated
12+
13+
- Deprecated the `threshold` parameter in the `RadiusClustering` class. Use `radius` instead.
14+
15+
### Changed
16+
17+
- Updated all the attributes in the `RadiusClustering` class to fit `scikit-learn` standards and conventions.
18+
- Updated the tests cases to reflect the changes in the `RadiusClustering` class.
19+
- Updated README and documentation to reflect the new `radius` parameter and the deprecation of `threshold`.

docs/source/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
project = "Radius Clustering"
1717
copyright = "2024, Haenn Quentin, Chardin Brice, Baron Mickaël"
1818
author = "Haenn Quentin, Chardin Brice, Baron Mickaël"
19-
release = "1.0"
19+
release = "1.3.0"
2020

2121
# -- General configuration ---------------------------------------------------
2222
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration

docs/source/usage.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ Here's a basic example of how to use Radius Clustering:
1212
X = np.random.rand(100, 2)
1313
1414
# Create an instance of MdsClustering
15-
rad = RadiusClustering(manner="approx", threshold=0.5)
15+
rad = RadiusClustering(manner="approx", radius=0.5)
16+
# Attention: the 'threshold' parameter is deprecated by version 1.3.0
17+
# and will be removed in a future version. Use 'radius' instead.
1618
1719
# Fit the model to the data
1820
rad.fit(X)

examples/plot_iris_example.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@
8282
# We create an instance of the `RadiusClustering` class and fit it to the Iris dataset.
8383
import time
8484

85-
rad = RadiusClustering(manner="exact", threshold=1.43)
85+
rad = RadiusClustering(manner="exact", radius=1.43)
8686
t0 = time.time()
8787
rad.fit(X)
8888
t_rad = time.time() - t0
@@ -242,7 +242,7 @@ def get_order_labels(kmeans, rad, data):
242242

243243
# Compute clustering with MDS
244244

245-
rad = RadiusClustering(manner="exact", threshold=232.09)
245+
rad = RadiusClustering(manner="exact", radius=232.09)
246246
t0 = time.time()
247247
rad.fit(X)
248248
t_rad = time.time() - t0

pyproject.toml

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ documentation = "https://lias-laboratory.github.io/radius_clustering/"
5252
[project.optional-dependencies]
5353
dev = [
5454
"pytest>=8.3.3",
55+
"pytest-cov>=5.0.0",
5556
"pandas",
5657
"cython>=3.0",
5758
"setuptools>= 61.0",
@@ -80,8 +81,22 @@ pythonpath = "src"
8081
testpaths = ["tests"]
8182
addopts = [
8283
"--import-mode=importlib",
84+
"--cov=src/radius_clustering",
85+
"--cov-report=term-missing",
86+
"--cov-report=html:coverage_html_report",
8387
]
8488

89+
[tool.coverage.run]
90+
source = ["src/radius_clustering"]
91+
branch = true
92+
93+
[tool.coverage.report]
94+
show_missing = true
95+
96+
[tool.coverage.html]
97+
directory = "coverage_html_report"
98+
title = "Coverage Report"
99+
85100
[tool.ruff]
86101
# Exclude a variety of commonly ignored directories.
87102
exclude = [
@@ -105,14 +120,14 @@ exclude = [
105120

106121
# Same as Black.
107122
line-length = 88
108-
indent-width = 4
123+
target-version = "py310"
109124

110125
[tool.ruff.lint]
111126
# Enable Pyflakes (`F`) and a subset of the pycodestyle (`E`) codes by default.
112127
# Unlike Flake8, Ruff doesn't enable pycodestyle warnings (`W`) or
113128
# McCabe complexity (`C901`) by default.
114-
select = ["E", "F"]
115-
ignore = []
129+
select = ["E", "F", "W", "I"]
130+
ignore = ["E203", "E731", "E741"]
116131

117132
# Allow fix for all enabled rules (when `--fix`) is provided.
118133
fixable = ["ALL"]

setup.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import platform
2-
from setuptools import setup, Extension
3-
from Cython.Build import cythonize
2+
43
import numpy as np
4+
from Cython.Build import cythonize
5+
from setuptools import Extension, setup
56

67
SYSTEM = platform.system()
78
CPU = platform.processor()
@@ -21,7 +22,10 @@
2122
extensions = [
2223
Extension(
2324
"radius_clustering.utils._emos",
24-
["src/radius_clustering/utils/emos.pyx", "src/radius_clustering/utils/main-emos.c"],
25+
[
26+
"src/radius_clustering/utils/emos.pyx",
27+
"src/radius_clustering/utils/main-emos.c"
28+
],
2529
include_dirs=[np.get_include(), "src/radius_clustering/utils"],
2630
extra_compile_args=C_COMPILE_ARGS,
2731
),

src/radius_clustering/__init__.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,4 @@
22
from .radius_clustering import RadiusClustering
33

44
__all__ = ["RadiusClustering"]
5-
6-
# Optionally, you can set a version number for your package
7-
__version__ = "1.2.2"
5+
__version__ = "1.3.0"

0 commit comments

Comments
 (0)