Zgli: A Pipeline for Clustering by Compression with Application to Patient Stratification in Spondyloarthritis

Diogo Azevedo, Ana Maria Rodrigues, Helena Canhão, Alexandra M. Carvalho, André Souto

Research output: Contribution to journalArticlepeer-review

1 Citation (Scopus)
8 Downloads (Pure)


The normalized compression distance (NCD) is a similarity measure between a pair of finite objects based on compression. Clustering methods usually use distances (e.g., Euclidean distance, Manhattan distance) to measure the similarity between objects. The NCD is yet another distance with particular characteristics that can be used to build the starting distance matrix for methods such as hierarchical clustering or K-medoids. In this work, we propose Zgli, a novel Python module that enables the user to compute the NCD between files inside a given folder. Inspired by the CompLearn Linux command line tool, this module iterates on it by providing new text file compressors, a new compression-by-column option for tabular data, such as CSV files, and an encoder for small files made up of categorical data. Our results demonstrate that compression by column can yield better results than previous methods in the literature when clustering tabular data. Additionally, the categorical encoder shows that it can augment categorical data, allowing the use of the NCD for new data types. One of the advantages is that using this new feature does not require knowledge or context of the data. Furthermore, the fact that the new proposed module is written in Python, one of the most popular programming languages for machine learning, potentiates its use by developers to tackle problems with a new approach based on compression. This pipeline was tested in clinical data and proved a promising computational strategy by providing patient stratification via clusters aiding in precision medicine.

Original languageEnglish
Article number1219
Issue number3
Publication statusPublished - Feb 2023


  • clustering by compression
  • clustering techniques
  • CompLearn
  • Kolmogorov complexity
  • normalized compression distance
  • Zgli


Dive into the research topics of 'Zgli: A Pipeline for Clustering by Compression with Application to Patient Stratification in Spondyloarthritis'. Together they form a unique fingerprint.

Cite this