========
yacluster is a Python library which does `distance-based clustering`_ for 2D points. Only Python 3.4+ is officially supported, though other versions may work too. The project uses `semantic versioning`_ and is licensed under `the MIT license`_.
Usage
-----
The main utility is the ``yacluster.cluster`` function which takes two arguments:
* an iterable which yields two-element point tuples, each containing:
- a two-element tuple with X and Y coordinates;
- the actual object being clustered (or its identifier);
* a distance threshold; if a point is included into a cluster, it must be closer to its centroid than this value.
The function returns an iterable of two-element cluster tuples, each containing:
* a two-element tuple with X and Y coordinates of the cluster center;
* a list of objects belonging to the cluster.
Cluster’s centroid is defined as average coordinates of the cluster’s members.
Example
-------
.. code-block:: python
from yacluster import cluster
points = [
((1, 1.0), 'Foo'),
((1.0, 2), 'Bar'),
((2.0, 2.0), 'Baz'),
]
threshold = 1.1
expected_result = [
((1.0, 1.5), ['Foo', 'Bar']),
((2.0, 2.0), ['Baz']),
]
assert expected_result == list(cluster(points, threshold))
Development
-----------
Development requirements are listed in the ``requirements-development.txt`` file.
To run tests, execute ``./tests.py``.
Coding style is checked using `flake8 3.x`_.
.. _distance-based clustering: https://developers.google.com/maps/articles/toomanymarkers#distancebasedclustering
.. _flake8 3.x: http://flake8.pycqa.org/en/latest/
.. _semantic versioning: http://semver.org
.. _the MIT license: LICENSE
Metadata
Release files for yacluster 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| yacluster-1.0.0.tar.gz | 5.6 kB | Without provenance | Details for yacluster-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| yacluster-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for yacluster-1.0.0-py3-none-any.whl |
Total release size: 10.6 kB
Release files / yacluster-1.0.0.tar.gz
| Download URL | yacluster-1.0.0.tar.gz |
|---|---|
| Size | 5.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4ad583e5169c2bd360f3bda999624d413ddcd01e4934bee12f356860fe02f551
|
|
BLAKE2b-256 checksum How to use checksums |
8484bdd5757415eaab3872ada18a64c8047a9a476be75ea0c1ea465fc9f5e321
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / yacluster-1.0.0-py3-none-any.whl
| Download URL | yacluster-1.0.0-py3-none-any.whl |
|---|---|
| Size | 5.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ef7e103a9dca2ca0445f204c36c9fbdc32f20d8a667062ef0f4c55aa696e41be
|
|
BLAKE2b-256 checksum How to use checksums |
13cd753bddc2c22be14785b4b5506dd790f856cb0c2c3f3472aaaa441d760c58
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for yacluster 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.