NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Clustering of Medical Free-Text Records Based on Word Embeddings

Adam Gabriel Dobrakowski, Agnieszka Mykowiecka, Malgorzata Marciniak, Wojciech Jaworski, Przemyslaw BiecekarXiv 2019

Abstract

Is it true that patients with similar conditions get similar diagnoses? In this paper, we introduce a method for representing medical visits based on free-text descriptions recorded by doctors. We present a new approach for clustering patient visits and apply it to a corpus of 100,000 records. Our method yields stable, distinct segments of visits that correlate strongly with final medical diagnoses, demonstrating how such algorithms can assist doctors in clinical practice.

Introduction

A vast amount of critical medical information is locked away in "free-text" clinical records—the unstructured notes doctors jot down during interviews and examinations. While structured data like age or sex is easily analyzed, narrative notes are rich in nuance but difficult for computers to process.

This paper addresses the challenge of clustering individual medical visits rather than entire patient histories. This is particularly relevant for languages like Polish, which lack the comprehensive medical ontologies (like UMLS) available for English. The goal is to help clinicians identify similar cases, validate unusual diagnoses, and discover patterns in symptoms and treatments across massive datasets.

Methodology

The researchers developed a four-step pipeline to transform unstructured text into meaningful clusters:

  1. Medical Concept Extraction: Using Polish-specific NLP tools (Concraft and TermoPL), frequent noun phrases were identified. 4,800 phrases were manually annotated with 137 semantic labels (e.g., anatomy, disease, test).
  2. Domain-Specific Embeddings: GloVe embeddings were trained specifically on the medical corpus. This captured how terms like "cough" shift meaning between a patient's interview (subjective) and a doctor's exam (objective).
  3. Visit Representation: Each visit was represented by a vector created by averaging the embeddings of concepts found in the interview and examination sections, then concatenating them.
  4. Clustering: Hierarchical clustering (Ward’s method) was selected for its superior stability over k-means. The "Elbow method" determined the optimal number of clusters for various medical specialties.

The Geometry of Clinical Language

A key finding of this research is that medical relationships are captured as geometric analogies in vector space. By training on domain-specific data, the model learned consistent spatial relationships between concepts.

PCA projections of medical word embeddings showing consistent geometric relationships across different semantic categories.

As shown in the figure above, the model successfully maps relationships such as lateralization (e.g., elbow to right elbow) and the association between anatomy and symptoms (e.g., knee to knee pain). These consistent vector offsets demonstrate that the embeddings capture the underlying "logic" of medical terminology.

Key Results and Insights

  • Stability and Accuracy: The clusters showed high stability, with an Adjusted Rand Index (ARI) between 0.69 and 0.87. On a custom medical analogy task, the model achieved a top-1 accuracy of ~17%, which is significant given the specialized nature of the dataset.
  • Clinical Alignment: Clustering was performed without using ICD-10 diagnosis codes. However, the resulting clusters naturally aligned with these external labels. For instance, Family Medicine clusters clearly separated respiratory diseases from circulatory issues.
  • The "Doctor Fingerprint": Some clusters mapped perfectly to individual doctors, suggesting the method can capture unique diagnostic or reporting styles.
  • Recommendation Patterns: The model identified "characteristic" recommendations for specific clusters, such as identifying a prenatal care group in Gynecology based on the frequency of folic acid prescriptions.

Conclusion

While the reliance on manual annotation for initial phrase extraction is a limitation, this study proves that NLP pipelines can successfully capture the medical "truth" of unstructured records. Future work involves developing real-time recommendation systems to suggest potential diagnoses or treatments based on historical case clusters, effectively serving as a clinical decision support tool.

Summary updated

Abstract

Is it true that patients with similar conditions get similar diagnoses? In this paper we show NLP methods and a unique corpus of documents to validate this claim. We (1) introduce a method for representation of medical visits based on free-text descriptions recorded by doctors, (2) introduce a new method for clustering of patients' visits and (3) present an~application of the proposed method on a corpus of 100,000 visits. With the proposed method we obtained stable and separated segments of visits which were positively validated against final medical diagnoses. We show how the presented algorithm may be used to aid doctors during their practice.
BibTeX
@misc{dobrakowski2019clustering,
  author = {Adam Gabriel Dobrakowski and Agnieszka Mykowiecka and Malgorzata Marciniak and Wojciech Jaworski and Przemyslaw Biecek},
  title = {{Clustering of Medical Free-Text Records Based on Word Embeddings}},
  year = {2019},
  eprint = {1907.04152},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1907.04152},
}
Figure