JOURNAL ARTICLE

Using K-Means Clustering in Python with Periodic Boundary Conditions

Alicja Miniak-GóreckaKrzysztof PodlaskiTomasz M. Gwizdałła

Year: 2022 Journal:   Symmetry Vol: 14 (6)Pages: 1237-1237   Publisher: Multidisciplinary Digital Publishing Institute

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:
Cluster analysis Python (programming language) Periodic boundary conditions Computer science Boundary value problem Boundary (topology) Algorithm Mathematics Mathematical analysis Artificial intelligence

Metrics

11
Cited By
5.64
FWCI (Field Weighted Citation Impact)
44
Refs
0.80
Citation Normalized Percentile
Is in top 1%
Is in top 10%

Citation History

Topics

Scientific Research and Discoveries
Physical Sciences →  Physics and Astronomy →  Statistical and Nonlinear Physics
Theoretical and Computational Physics
Physical Sciences →  Physics and Astronomy →  Condensed Matter Physics
Data Management and Algorithms
Physical Sciences →  Computer Science →  Signal Processing

Related Documents

JOURNAL ARTICLE

Implementation of Clustering using K-Means in Python

Ahmad Farhan AlShammari

Journal:   International Journal of Computer Applications Year: 2024 Vol: 186 (40)Pages: 12-17
JOURNAL ARTICLE

Crime Data Analysis in Python using K - Means Clustering

Md Abu Saleh

Journal:   International Journal for Research in Applied Science and Engineering Technology Year: 2019 Vol: 7 (4)Pages: 151-155
JOURNAL ARTICLE

K-MEANS CLUSTERING FOR PROBLEMS WITH PERIODIC ATTRIBUTES

Martin VejmelkaPetr Musı́lekMilan PalušEmil Pelikán

Journal:   International Journal of Pattern Recognition and Artificial Intelligence Year: 2009 Vol: 23 (04)Pages: 721-743
© 2026 ScienceGate Book Chapters — All rights reserved.