Skip to main content

Weighted KMeans Clustering for Geolocational Problem

Repo for weighted k means clustering for specifically geo locational problems.

For an example and mathematical explanation:

https://emrahcimren.github.io/data%20science/Greenfield-Analysis-with-Weighted-Clustering/

Prerequisites

Install environment.yml for prerequisites.

conda env create -f environment.yml

To recreate environment.yml

conda env export > environment.yml

To create requirements.txt from environment.yml

pip freeze > requirements.txt

Installation

pip install cimren-wkmeans-geo

Inputs

input_locations is a pandas dataframe with the following format.

LOCATION_NAME LATITUDE LONGITUDE WEIGHT VOLUME
LOC 0 -27.0065 170.583 1 10

number_of_clusters: Number of clusters to be created

minimum_elements_in_a_cluster: Minimum elements in a cluster

maximum_elements_in_a_cluster: Maximum elements in a cluster

maximum_volume_in_a_cluster: Maximum volume that can fit in a cluster; if set to None, then it is disabled

maximum_iteration: How many maximum number of steps the algorithm takes to stop if it does not find the solution

enable_minimum_maximum_elements_in_a_cluster: True/False to enable minimum and maximum cluster size

objective_range: Acceptable difference between objectives at each iteration

Data

Package has a sample data set

from wkmeans_geo.src import data
data.locations_test
data.number_of_clusters
data.minimum_elements_in_a_cluster
data.maximum_elements_in_a_cluster
data.maximum_volume_in_a_cluster
data.maximum_iteration
data.enable_minimum_maximum_elements_in_a_cluster
data.objective_range

How to use

from wkmeans_geo.src import data
from wkmeans_geo import wkmeans_clustering as wkc
clusters, locations_with_clusters = wkc.calculate_clusters(
                                       data.locations_test,
                                       data.number_of_clusters,
                                       data.minimum_elements_in_a_cluster,
                                       data.maximum_elements_in_a_cluster,
                                       data.maximum_volume_in_a_cluster,
                                       data.maximum_iteration,
                                       data.objective_range,
                                       data.enable_minimum_maximum_elements_in_a_cluster)

Metadata

Release files for cimren-wkmeans-geo 1.3.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cimren-wkmeans-geo 1.3.4
File Size Uploaded Provenance Actions
cimren-wkmeans-geo-1.3.4.tar.gz 7.6 kB Without provenance Details for cimren-wkmeans-geo-1.3.4.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for cimren-wkmeans-geo 1.3.4
File Interpreter ABI Platform Actions
cimren_wkmeans_geo-1.3.4-py3-none-any.whl Python 3 none any Details for cimren_wkmeans_geo-1.3.4-py3-none-any.whl

Total release size: 16.3 kB

Release files / cimren-wkmeans-geo-1.3.4.tar.gz

Download URL cimren-wkmeans-geo-1.3.4.tar.gz
Size 7.6 kB
Tags Source
SHA-256 checksum
How to use checksums
5a161e5a663ff318fee58a421d052750f8755df3db5762e75966a009d4a99b60
BLAKE2b-256 checksum
How to use checksums
e6653d6701455498cab21ec4848b42c9b925cca77ac1290fbb89da3499874d09
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/45.2.0.post20200210 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.8.1

Release files / cimren_wkmeans_geo-1.3.4-py3-none-any.whl

Download URL cimren_wkmeans_geo-1.3.4-py3-none-any.whl
Size 8.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1a4b50b25401609a9d978abd8bf6e37da2c478db2de0f50172fd176e79b0f472
BLAKE2b-256 checksum
How to use checksums
da35ec20a5eda60cf9743214fae5c66d241fc65c77fc3c53d0129e6a5e8b20f3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/45.2.0.post20200210 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.8.1

Security for cimren-wkmeans-geo 1.3.4

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page