From 24ae5d8b972197b1946b784613234b318106738a Mon Sep 17 00:00:00 2001 From: Xin Han Date: Sun, 22 Mar 2026 03:36:44 +1100 Subject: [PATCH] fix kcluster --- README.md | 2 +- ikpykit/cluster/_kcluster.py | 4 ++-- ikpykit/graph/tests/test_ikgod.py | 2 -- mkdocs.yml | 5 ++--- pyproject.toml | 4 ++-- uv.lock | 22 +++++++++------------- 6 files changed, 16 insertions(+), 23 deletions(-) diff --git a/README.md b/README.md index ba41626..aeb4a39 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ -![Python](https://img.shields.io/badge/python-3.9%20%7C%203.10%20%7C%203.11%20%7C%203.12-blue) +![Python](https://img.shields.io/badge/python-3.9%20%7C%203.10%20%7C%203.11%20%7C%203.12%20%7C%203.13-blue) [![PyPI](https://img.shields.io/pypi/v/ikpykit)](https://pypi.org/project/ikpykit/) [![codecov](https://codecov.io/gh/IsolationKernel/ikpykit/branch/main/graph/badge.svg)](https://codecov.io/gh/IsolationKernel/ikpykit) [![Build status](https://github.com/IsolationKernel/ikpykit/actions/workflows/ci.yml/badge.svg)](https://github.com/IsolationKernel/ikpykit/actions/workflows/ci.yml) diff --git a/ikpykit/cluster/_kcluster.py b/ikpykit/cluster/_kcluster.py index 03b8ef0..825dfd3 100644 --- a/ikpykit/cluster/_kcluster.py +++ b/ikpykit/cluster/_kcluster.py @@ -37,15 +37,15 @@ def delete_points(self, points, X): if isinstance(points, Integral): if points not in self.points_: raise ValueError(f"Point {points} not in cluster {self.id}") - self.points_.remove(points) self.reduce_kernel_mean_(X) + self.points_.remove(points) elif isinstance(points, Iterable): missing_points = [p for p in points if p not in self.points_] if missing_points: raise ValueError(f"Points {missing_points} not in cluster {self.id}") + self.reduce_kernel_mean_(X) for p in points: self.points_.remove(p) - self.reduce_kernel_mean_(X) def reduce_kernel_mean_(self, X): if self.kernel_mean_ is None: diff --git a/ikpykit/graph/tests/test_ikgod.py b/ikpykit/graph/tests/test_ikgod.py index 31f8cba..3551dce 100644 --- a/ikpykit/graph/tests/test_ikgod.py +++ b/ikpykit/graph/tests/test_ikgod.py @@ -125,8 +125,6 @@ def test_ikgod_h_hop_neighbors(): ] ) - np.random.rand(5, 2) - # h=1 should see only direct neighbors model_h1 = IKGOD(h=1, n_estimators=10) model_h1._get_h_nodes_n_dict(adjacency) diff --git a/mkdocs.yml b/mkdocs.yml index e202b44..6f1ec03 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -7,7 +7,7 @@ remote_branch: docs_dev site_description: Python library for Isolation Kernel Toolkit. site_author: Isolation Kernel Team use_directory_urls: false -copyright: Copyright © 2024 - 2025 Xin Han +copyright: Copyright © 2024 - 2026 Xin Han nav: - Home: @@ -67,7 +67,7 @@ plugins: - mkdocstrings: handlers: python: - import: + inventories: - https://docs.python.org/3/objects.inv - https://mkdocstrings.github.io/autorefs/objects.inv - https://www.mkdocs.org/objects.inv @@ -86,7 +86,6 @@ plugins: members_order: source docstring_options: ignore_init_summary: true - show_if_no_docstring: true - mkdocs-jupyter: ignore_h1_titles: True include_source: True diff --git a/pyproject.toml b/pyproject.toml index d56c4c9..05a5e4a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -97,8 +97,8 @@ docs = [ "mike==2.1.3", "mkdocs==1.6.1", "mkdocs-jupyter==0.25.0", - "mkdocstrings==0.26.1", - "mkdocstrings-python==1.11.1", + "mkdocstrings==0.30.1", + "mkdocstrings-python==1.18.2", "notebook==6.4.12", ] lint = ["black==24.8.0", "pre-commit>=4.3.0", "ruff>=0.14.5"] diff --git a/uv.lock b/uv.lock index 5e83de5..1efa74b 100644 --- a/uv.lock +++ b/uv.lock @@ -1363,8 +1363,8 @@ docs = [ { name = "mike", specifier = "==2.1.3" }, { name = "mkdocs", specifier = "==1.6.1" }, { name = "mkdocs-jupyter", specifier = "==0.25.0" }, - { name = "mkdocstrings", specifier = "==0.26.1" }, - { name = "mkdocstrings-python", specifier = "==1.11.1" }, + { name = "mkdocstrings", specifier = "==0.30.1" }, + { name = "mkdocstrings-python", specifier = "==1.18.2" }, { name = "notebook", specifier = "==6.4.12" }, ] lint = [ @@ -2806,11 +2806,9 @@ wheels = [ [[package]] name = "mkdocstrings" -version = "0.26.1" +version = "0.30.1" source = { registry = "https://pypi.org/simple" } dependencies = [ - { name = "click", version = "8.1.8", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.10'" }, - { name = "click", version = "8.3.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.10'" }, { name = "importlib-metadata", marker = "python_full_version < '3.10'" }, { name = "jinja2" }, { name = "markdown", version = "3.9", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.10'" }, @@ -2818,29 +2816,27 @@ dependencies = [ { name = "markupsafe" }, { name = "mkdocs" }, { name = "mkdocs-autorefs" }, - { name = "platformdirs", version = "4.4.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.10'" }, - { name = "platformdirs", version = "4.5.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.10'" }, { name = "pymdown-extensions" }, - { name = "typing-extensions", marker = "python_full_version < '3.10'" }, ] -sdist = { url = "https://files.pythonhosted.org/packages/e6/bf/170ff04de72227f715d67da32950c7b8434449f3805b2ec3dd1085db4d7c/mkdocstrings-0.26.1.tar.gz", hash = "sha256:bb8b8854d6713d5348ad05b069a09f3b79edbc6a0f33a34c6821141adb03fe33", size = 92677, upload-time = "2024-09-06T10:26:06.736Z" } +sdist = { url = "https://files.pythonhosted.org/packages/c5/33/2fa3243439f794e685d3e694590d28469a9b8ea733af4b48c250a3ffc9a0/mkdocstrings-0.30.1.tar.gz", hash = "sha256:84a007aae9b707fb0aebfc9da23db4b26fc9ab562eb56e335e9ec480cb19744f", size = 106350, upload-time = "2025-09-19T10:49:26.446Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/23/cc/8ba127aaee5d1e9046b0d33fa5b3d17da95a9d705d44902792e0569257fd/mkdocstrings-0.26.1-py3-none-any.whl", hash = "sha256:29738bfb72b4608e8e55cc50fb8a54f325dc7ebd2014e4e3881a49892d5983cf", size = 29643, upload-time = "2024-09-06T10:26:04.498Z" }, + { url = "https://files.pythonhosted.org/packages/7b/2c/f0dc4e1ee7f618f5bff7e05898d20bf8b6e7fa612038f768bfa295f136a4/mkdocstrings-0.30.1-py3-none-any.whl", hash = "sha256:41bd71f284ca4d44a668816193e4025c950b002252081e387433656ae9a70a82", size = 36704, upload-time = "2025-09-19T10:49:24.805Z" }, ] [[package]] name = "mkdocstrings-python" -version = "1.11.1" +version = "1.18.2" source = { registry = "https://pypi.org/simple" } dependencies = [ { name = "griffe", version = "1.14.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.10'" }, { name = "griffe", version = "1.15.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.10'" }, { name = "mkdocs-autorefs" }, { name = "mkdocstrings" }, + { name = "typing-extensions", marker = "python_full_version < '3.11'" }, ] -sdist = { url = "https://files.pythonhosted.org/packages/fc/ba/534c934cd0a809f51c91332d6ed278782ee4126b8ba8db02c2003f162b47/mkdocstrings_python-1.11.1.tar.gz", hash = "sha256:8824b115c5359304ab0b5378a91f6202324a849e1da907a3485b59208b797322", size = 166890, upload-time = "2024-09-03T17:20:54.904Z" } +sdist = { url = "https://files.pythonhosted.org/packages/95/ae/58ab2bfbee2792e92a98b97e872f7c003deb903071f75d8d83aa55db28fa/mkdocstrings_python-1.18.2.tar.gz", hash = "sha256:4ad536920a07b6336f50d4c6d5603316fafb1172c5c882370cbbc954770ad323", size = 207972, upload-time = "2025-08-28T16:11:19.847Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/2f/f2/2a2c48fda645ac6bbe73bcc974587a579092b6868e6ff8bc6d177f4db38a/mkdocstrings_python-1.11.1-py3-none-any.whl", hash = "sha256:a21a1c05acef129a618517bb5aae3e33114f569b11588b1e7af3e9d4061a71af", size = 109297, upload-time = "2024-09-03T17:20:52.621Z" }, + { url = "https://files.pythonhosted.org/packages/d5/8f/ce008599d9adebf33ed144e7736914385e8537f5fc686fdb7cceb8c22431/mkdocstrings_python-1.18.2-py3-none-any.whl", hash = "sha256:944fe6deb8f08f33fa936d538233c4036e9f53e840994f6146e8e94eb71b600d", size = 138215, upload-time = "2025-08-28T16:11:18.176Z" }, ] [[package]]