Next Article in Journal
Dynamic Response of Vibratory Piling Machines for Ground Foundations
Previous Article in Journal
Optimal Design and Analysis for a New 1-DOF Compliant Stage Based on Additive Manufacturing Method for Testing Medical Specimens
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

Using K-Means Clustering in Python with Periodic Boundary Conditions

by
Alicja Miniak-Górecka
*,
Krzysztof Podlaski
and
Tomasz Gwizdałła
Faculty of Physics and Applied Informatics, University of Lodz, Pomorska 149/153, 90-236 Lodz, Poland
*
Author to whom correspondence should be addressed.
Symmetry 2022, 14(6), 1237; https://doi.org/10.3390/sym14061237
Submission received: 26 May 2022 / Revised: 7 June 2022 / Accepted: 12 June 2022 / Published: 14 June 2022
(This article belongs to the Section Computer)

Abstract

Periodic boundary conditions are natural in many scientific problems, and often lead to particular symmetries. Working with datasets that express periodicity properties requires special approaches when analyzing these phenomena. Periodic boundary conditions often help to solve or describe the problem in a much simpler way. The angular rotational symmetry is an example of periodic boundary conditions. This symmetry implies angular momentum conservation. On the other hand, clustering is one of the first and most basic methods used in data analysis. It is often a starting point when new data are acquired and understood. K-means clustering is one of the most commonly used clustering methods. It can be applied to many different situations with reasonably good results. Unfortunately, the original k-means approach does not cope well with the periodic properties of the data. For example, the original k-means algorithm treats a zero angle as very far from an angle that is 359 degrees. Periodic boundary conditions often change the classical distance measure and introduce an error in k-means clustering. In the paper, we discuss the problem of periodicity in the dataset and present a periodic k-means algorithm that modifies the original approach. Considering that many data scientists prefer on-the-shelf solutions, such as libraries available in Python, we present how easily they can incorporate periodicity into existing k-means implementation in the PyClustering library. It allows anyone to integrate periodic conditions without significant additional costs. The paper evaluates the described method using three different datasets: the artificial dataset, wind direction measurement, and the New York taxi service dataset. The proposed periodic k-means provides better results when the dataset manifests some periodic properties.
Keywords: k-means; clustering; periodicity; Python k-means; clustering; periodicity; Python

Share and Cite

MDPI and ACS Style

Miniak-Górecka, A.; Podlaski, K.; Gwizdałła, T. Using K-Means Clustering in Python with Periodic Boundary Conditions. Symmetry 2022, 14, 1237. https://doi.org/10.3390/sym14061237

AMA Style

Miniak-Górecka A, Podlaski K, Gwizdałła T. Using K-Means Clustering in Python with Periodic Boundary Conditions. Symmetry. 2022; 14(6):1237. https://doi.org/10.3390/sym14061237

Chicago/Turabian Style

Miniak-Górecka, Alicja, Krzysztof Podlaski, and Tomasz Gwizdałła. 2022. "Using K-Means Clustering in Python with Periodic Boundary Conditions" Symmetry 14, no. 6: 1237. https://doi.org/10.3390/sym14061237

APA Style

Miniak-Górecka, A., Podlaski, K., & Gwizdałła, T. (2022). Using K-Means Clustering in Python with Periodic Boundary Conditions. Symmetry, 14(6), 1237. https://doi.org/10.3390/sym14061237

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop