clustelia 0.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- clustelia-0.0.0/PKG-INFO +68 -0
- clustelia-0.0.0/README.md +51 -0
- clustelia-0.0.0/pyproject.toml +28 -0
- clustelia-0.0.0/setup.cfg +4 -0
- clustelia-0.0.0/src/clustelia/__init__.py +6 -0
- clustelia-0.0.0/src/clustelia/_summary.py +62 -0
- clustelia-0.0.0/src/clustelia.egg-info/PKG-INFO +68 -0
- clustelia-0.0.0/src/clustelia.egg-info/SOURCES.txt +9 -0
- clustelia-0.0.0/src/clustelia.egg-info/dependency_links.txt +1 -0
- clustelia-0.0.0/src/clustelia.egg-info/top_level.txt +1 -0
- clustelia-0.0.0/tests/test_summary.py +31 -0
clustelia-0.0.0/PKG-INFO
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: clustelia
|
|
3
|
+
Version: 0.0.0
|
|
4
|
+
Summary: Cluster-label diagnostics and an evolving foundation for clustering analysis.
|
|
5
|
+
Author: Jaime Vera-Jaramillo
|
|
6
|
+
Project-URL: Homepage, https://github.com/jaimevera1107/clustelia
|
|
7
|
+
Project-URL: Repository, https://github.com/jaimevera1107/clustelia
|
|
8
|
+
Project-URL: Issues, https://github.com/jaimevera1107/clustelia/issues
|
|
9
|
+
Keywords: clustering,cluster-analysis,unsupervised-learning,machine-learning
|
|
10
|
+
Classifier: Development Status :: 2 - Pre-Alpha
|
|
11
|
+
Classifier: Intended Audience :: Science/Research
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
14
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
15
|
+
Requires-Python: >=3.10
|
|
16
|
+
Description-Content-Type: text/markdown
|
|
17
|
+
|
|
18
|
+
# Clustelia
|
|
19
|
+
|
|
20
|
+
**Clustelia** is a Python project for clustering analysis and, over time, automated clustering and model selection.
|
|
21
|
+
|
|
22
|
+
## Current scope — 0.0.0
|
|
23
|
+
|
|
24
|
+
This is an **early, functional preview**, not a completed AutoML toolkit. It provides a dependency-free utility to summarize cluster assignments (sizes, proportions, number of clusters, and noise count). Fitting clustering models, model selection and advanced stability analysis are planned, not available in this release.
|
|
25
|
+
|
|
26
|
+
### Install
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
pip install clustelia==0.0.0
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### Use
|
|
33
|
+
|
|
34
|
+
```python
|
|
35
|
+
from clustelia import summarize_clusters
|
|
36
|
+
|
|
37
|
+
summary = summarize_clusters([0, 0, 1, -1])
|
|
38
|
+
print(summary.n_clusters) # 2
|
|
39
|
+
print(summary.counts) # {0: 2, 1: 1, -1: 1}
|
|
40
|
+
print(summary.shares) # {0: 0.5, 1: 0.25, -1: 0.25}
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Development
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
python -m pip install -e .
|
|
47
|
+
python -m unittest discover -s tests -v
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Releasing
|
|
51
|
+
|
|
52
|
+
PyPI publishes automatically through GitHub Actions and Trusted Publishing when a GitHub Release is **published** with a version tag matching `pyproject.toml` (e.g., `v0.0.0`). The workflow checks the version, runs tests, builds source and wheel distributions and uploads them to PyPI.
|
|
53
|
+
|
|
54
|
+
For the **first publication**, register a PyPI pending trusted publisher first:
|
|
55
|
+
|
|
56
|
+
- PyPI project: `clustelia`
|
|
57
|
+
- GitHub owner: `jaimevera1107`
|
|
58
|
+
- Repository: `clustelia`
|
|
59
|
+
- Workflow: `publish.yml`
|
|
60
|
+
- Environment: `pypi`
|
|
61
|
+
|
|
62
|
+
Then publish a GitHub Release for tag `v0.0.0`.
|
|
63
|
+
|
|
64
|
+
**Important:** A pending trusted publisher does not reserve a PyPI project name. The first successful upload creates the project. Releasing a version twice is not possible on PyPI; update the version before creating each new release.
|
|
65
|
+
|
|
66
|
+
## License
|
|
67
|
+
|
|
68
|
+
A project license has not yet been selected. Choose and add one before broad distribution if you want to grant explicit open-source reuse rights.
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# Clustelia
|
|
2
|
+
|
|
3
|
+
**Clustelia** is a Python project for clustering analysis and, over time, automated clustering and model selection.
|
|
4
|
+
|
|
5
|
+
## Current scope — 0.0.0
|
|
6
|
+
|
|
7
|
+
This is an **early, functional preview**, not a completed AutoML toolkit. It provides a dependency-free utility to summarize cluster assignments (sizes, proportions, number of clusters, and noise count). Fitting clustering models, model selection and advanced stability analysis are planned, not available in this release.
|
|
8
|
+
|
|
9
|
+
### Install
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
pip install clustelia==0.0.0
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
### Use
|
|
16
|
+
|
|
17
|
+
```python
|
|
18
|
+
from clustelia import summarize_clusters
|
|
19
|
+
|
|
20
|
+
summary = summarize_clusters([0, 0, 1, -1])
|
|
21
|
+
print(summary.n_clusters) # 2
|
|
22
|
+
print(summary.counts) # {0: 2, 1: 1, -1: 1}
|
|
23
|
+
print(summary.shares) # {0: 0.5, 1: 0.25, -1: 0.25}
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Development
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
python -m pip install -e .
|
|
30
|
+
python -m unittest discover -s tests -v
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Releasing
|
|
34
|
+
|
|
35
|
+
PyPI publishes automatically through GitHub Actions and Trusted Publishing when a GitHub Release is **published** with a version tag matching `pyproject.toml` (e.g., `v0.0.0`). The workflow checks the version, runs tests, builds source and wheel distributions and uploads them to PyPI.
|
|
36
|
+
|
|
37
|
+
For the **first publication**, register a PyPI pending trusted publisher first:
|
|
38
|
+
|
|
39
|
+
- PyPI project: `clustelia`
|
|
40
|
+
- GitHub owner: `jaimevera1107`
|
|
41
|
+
- Repository: `clustelia`
|
|
42
|
+
- Workflow: `publish.yml`
|
|
43
|
+
- Environment: `pypi`
|
|
44
|
+
|
|
45
|
+
Then publish a GitHub Release for tag `v0.0.0`.
|
|
46
|
+
|
|
47
|
+
**Important:** A pending trusted publisher does not reserve a PyPI project name. The first successful upload creates the project. Releasing a version twice is not possible on PyPI; update the version before creating each new release.
|
|
48
|
+
|
|
49
|
+
## License
|
|
50
|
+
|
|
51
|
+
A project license has not yet been selected. Choose and add one before broad distribution if you want to grant explicit open-source reuse rights.
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=69", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "clustelia"
|
|
7
|
+
version = "0.0.0"
|
|
8
|
+
description = "Cluster-label diagnostics and an evolving foundation for clustering analysis."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.10"
|
|
11
|
+
authors = [{ name = "Jaime Vera-Jaramillo" }]
|
|
12
|
+
keywords = ["clustering", "cluster-analysis", "unsupervised-learning", "machine-learning"]
|
|
13
|
+
classifiers = [
|
|
14
|
+
"Development Status :: 2 - Pre-Alpha",
|
|
15
|
+
"Intended Audience :: Science/Research",
|
|
16
|
+
"Programming Language :: Python :: 3",
|
|
17
|
+
"Programming Language :: Python :: 3 :: Only",
|
|
18
|
+
"Topic :: Scientific/Engineering :: Artificial Intelligence",
|
|
19
|
+
]
|
|
20
|
+
dependencies = []
|
|
21
|
+
|
|
22
|
+
[project.urls]
|
|
23
|
+
Homepage = "https://github.com/jaimevera1107/clustelia"
|
|
24
|
+
Repository = "https://github.com/jaimevera1107/clustelia"
|
|
25
|
+
Issues = "https://github.com/jaimevera1107/clustelia/issues"
|
|
26
|
+
|
|
27
|
+
[tool.setuptools.packages.find]
|
|
28
|
+
where = ["src"]
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"""Lightweight, dependency-free cluster-label diagnostics."""
|
|
2
|
+
|
|
3
|
+
from collections import Counter
|
|
4
|
+
from dataclasses import dataclass
|
|
5
|
+
from typing import Hashable, Iterable
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
@dataclass(frozen=True)
|
|
9
|
+
class ClusterSummary:
|
|
10
|
+
"""Summary of assigned cluster labels.
|
|
11
|
+
|
|
12
|
+
``counts`` and ``shares`` include the noise label, when present.
|
|
13
|
+
``shares`` are relative to all observations, including noise.
|
|
14
|
+
"""
|
|
15
|
+
|
|
16
|
+
n_samples: int
|
|
17
|
+
n_clusters: int
|
|
18
|
+
n_noise: int
|
|
19
|
+
counts: dict[Hashable, int]
|
|
20
|
+
shares: dict[Hashable, float]
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def summarize_clusters(
|
|
24
|
+
labels: Iterable[Hashable], *, noise_label: Hashable = -1
|
|
25
|
+
) -> ClusterSummary:
|
|
26
|
+
"""Summarize a sequence of cluster assignments.
|
|
27
|
+
|
|
28
|
+
Parameters
|
|
29
|
+
----------
|
|
30
|
+
labels:
|
|
31
|
+
Hashable cluster labels. Iterators are consumed once. Empty input is
|
|
32
|
+
accepted. Labels may be strings, integers, or other hashable values.
|
|
33
|
+
noise_label:
|
|
34
|
+
Label interpreted as unassigned/noise (default ``-1``, common in
|
|
35
|
+
DBSCAN/HDBSCAN). Noise does not count toward ``n_clusters``.
|
|
36
|
+
|
|
37
|
+
Returns
|
|
38
|
+
-------
|
|
39
|
+
ClusterSummary
|
|
40
|
+
Counts, fractions and sample/cluster/noise totals. No fitted model
|
|
41
|
+
or input data matrix is required.
|
|
42
|
+
|
|
43
|
+
Examples
|
|
44
|
+
--------
|
|
45
|
+
>>> s = summarize_clusters([0, 0, 1, -1])
|
|
46
|
+
>>> (s.n_samples, s.n_clusters, s.n_noise)
|
|
47
|
+
(4, 2, 1)
|
|
48
|
+
>>> s.shares[0]
|
|
49
|
+
0.5
|
|
50
|
+
"""
|
|
51
|
+
counts = dict(Counter(labels))
|
|
52
|
+
n_samples = sum(counts.values())
|
|
53
|
+
n_noise = counts.get(noise_label, 0)
|
|
54
|
+
n_clusters = len(counts) - int(noise_label in counts)
|
|
55
|
+
shares = {label: count / n_samples for label, count in counts.items()}
|
|
56
|
+
return ClusterSummary(
|
|
57
|
+
n_samples=n_samples,
|
|
58
|
+
n_clusters=n_clusters,
|
|
59
|
+
n_noise=n_noise,
|
|
60
|
+
counts=counts,
|
|
61
|
+
shares=shares,
|
|
62
|
+
)
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: clustelia
|
|
3
|
+
Version: 0.0.0
|
|
4
|
+
Summary: Cluster-label diagnostics and an evolving foundation for clustering analysis.
|
|
5
|
+
Author: Jaime Vera-Jaramillo
|
|
6
|
+
Project-URL: Homepage, https://github.com/jaimevera1107/clustelia
|
|
7
|
+
Project-URL: Repository, https://github.com/jaimevera1107/clustelia
|
|
8
|
+
Project-URL: Issues, https://github.com/jaimevera1107/clustelia/issues
|
|
9
|
+
Keywords: clustering,cluster-analysis,unsupervised-learning,machine-learning
|
|
10
|
+
Classifier: Development Status :: 2 - Pre-Alpha
|
|
11
|
+
Classifier: Intended Audience :: Science/Research
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
14
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
15
|
+
Requires-Python: >=3.10
|
|
16
|
+
Description-Content-Type: text/markdown
|
|
17
|
+
|
|
18
|
+
# Clustelia
|
|
19
|
+
|
|
20
|
+
**Clustelia** is a Python project for clustering analysis and, over time, automated clustering and model selection.
|
|
21
|
+
|
|
22
|
+
## Current scope — 0.0.0
|
|
23
|
+
|
|
24
|
+
This is an **early, functional preview**, not a completed AutoML toolkit. It provides a dependency-free utility to summarize cluster assignments (sizes, proportions, number of clusters, and noise count). Fitting clustering models, model selection and advanced stability analysis are planned, not available in this release.
|
|
25
|
+
|
|
26
|
+
### Install
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
pip install clustelia==0.0.0
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### Use
|
|
33
|
+
|
|
34
|
+
```python
|
|
35
|
+
from clustelia import summarize_clusters
|
|
36
|
+
|
|
37
|
+
summary = summarize_clusters([0, 0, 1, -1])
|
|
38
|
+
print(summary.n_clusters) # 2
|
|
39
|
+
print(summary.counts) # {0: 2, 1: 1, -1: 1}
|
|
40
|
+
print(summary.shares) # {0: 0.5, 1: 0.25, -1: 0.25}
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Development
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
python -m pip install -e .
|
|
47
|
+
python -m unittest discover -s tests -v
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Releasing
|
|
51
|
+
|
|
52
|
+
PyPI publishes automatically through GitHub Actions and Trusted Publishing when a GitHub Release is **published** with a version tag matching `pyproject.toml` (e.g., `v0.0.0`). The workflow checks the version, runs tests, builds source and wheel distributions and uploads them to PyPI.
|
|
53
|
+
|
|
54
|
+
For the **first publication**, register a PyPI pending trusted publisher first:
|
|
55
|
+
|
|
56
|
+
- PyPI project: `clustelia`
|
|
57
|
+
- GitHub owner: `jaimevera1107`
|
|
58
|
+
- Repository: `clustelia`
|
|
59
|
+
- Workflow: `publish.yml`
|
|
60
|
+
- Environment: `pypi`
|
|
61
|
+
|
|
62
|
+
Then publish a GitHub Release for tag `v0.0.0`.
|
|
63
|
+
|
|
64
|
+
**Important:** A pending trusted publisher does not reserve a PyPI project name. The first successful upload creates the project. Releasing a version twice is not possible on PyPI; update the version before creating each new release.
|
|
65
|
+
|
|
66
|
+
## License
|
|
67
|
+
|
|
68
|
+
A project license has not yet been selected. Choose and add one before broad distribution if you want to grant explicit open-source reuse rights.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
clustelia
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import unittest
|
|
2
|
+
|
|
3
|
+
from clustelia import __version__, summarize_clusters
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class SummarizeClustersTests(unittest.TestCase):
|
|
7
|
+
def test_standard_labels_and_noise(self):
|
|
8
|
+
result = summarize_clusters([0, 0, 1, -1])
|
|
9
|
+
self.assertEqual(result.n_samples, 4)
|
|
10
|
+
self.assertEqual(result.n_clusters, 2)
|
|
11
|
+
self.assertEqual(result.n_noise, 1)
|
|
12
|
+
self.assertEqual(result.counts, {0: 2, 1: 1, -1: 1})
|
|
13
|
+
self.assertEqual(result.shares[0], 0.5)
|
|
14
|
+
|
|
15
|
+
def test_custom_noise_and_generator(self):
|
|
16
|
+
result = summarize_clusters((x for x in ["A", "A", "B", "NA"]), noise_label="NA")
|
|
17
|
+
self.assertEqual(result.n_clusters, 2)
|
|
18
|
+
self.assertEqual(result.n_noise, 1)
|
|
19
|
+
|
|
20
|
+
def test_empty(self):
|
|
21
|
+
result = summarize_clusters([])
|
|
22
|
+
self.assertEqual(result.n_samples, 0)
|
|
23
|
+
self.assertEqual(result.n_clusters, 0)
|
|
24
|
+
self.assertEqual(result.shares, {})
|
|
25
|
+
|
|
26
|
+
def test_version(self):
|
|
27
|
+
self.assertEqual(__version__, "0.0.0")
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
if __name__ == "__main__":
|
|
31
|
+
unittest.main()
|