HiGitClass: Keyword-Driven Hierarchical Classification of GitHub Repositories

Yu Zhang, Frank F. Xu, Sha Li, Yu Meng, Xuan Wang, Qi Li, Jiawei Han

Abstract

HiGitClass is a novel framework that automatically classifies GitHub repositories into a topic hierarchy using only a single keyword per category as supervision. By integrating structured metadata (users, tags) and unstructured text (READMEs) into a heterogeneous information network (HIN), the system generates high-quality synthetic training data. Experimental results show that HiGitClass outperforms existing weakly-supervised methods by over 20%, effectively addressing the challenge of large-scale, unlabeled repository data.

Introduction

GitHub currently hosts over 100 million repositories, yet more than 70% lack topic labels, making code discovery difficult. Manual classification is unfeasible at this scale, and traditional supervised learning requires massive labeled datasets that do not exist for most specialized domains. Furthermore, GitHub data is multi-modal, consisting of repository names, user ownership, and sparse tags in addition to README text.

GitHub repositories provide multi-modal data, including user information, tags, and README files, which are often sparsely labeled.

The authors address the challenge of keyword-driven hierarchical classification: building a system that understands a complex hierarchy (e.g., Machine Learning -> Computer Vision -> Image Generation) given only the hierarchy structure and one seed word (e.g., "dcgan") for each leaf.

Methodology

The HiGitClass framework consists of three primary stages designed to leverage the unique structure of GitHub data.

The HiGitClass framework architecture: from HIN encoding and keyword enrichment to pseudo-document generation and CNN-based classification.

1. Heterogeneous Information Network (HIN) Embedding

Rather than relying solely on README text, HiGitClass constructs a network connecting six node types: Words, Documents, Users, Tags, Name tokens, and Labels. Using a "word-centric star schema," the model learns embeddings that capture how words co-occur across different metadata types. This allows the system to recognize that terms like "dcgan" and "pytorch" are related via shared tags or users, even if they do not appear together in text.

2. Keyword Enrichment

A single seed keyword is often too narrow to represent a category. HiGitClass uses HIN embeddings to find semantic neighbors for each category, expanding the initial seed into a robust "keyword set" while ensuring that categories remain mutually exclusive.

3. Topic Modeling and Pseudo-Document Generation

To train a classifier without real labeled data, the framework generates synthetic "pseudo-documents." Each topic is modeled as a distribution on a unit sphere (using von Mises-Fisher distributions). By sampling words from these distributions, the system creates synthetic training examples that reflect the category's semantics. A CNN is then trained on these pseudo-documents to classify real repositories.

Results

HiGitClass was evaluated on two newly curated datasets: MACHINE-LEARNING (1,596 repositories) and BIOINFORMATICS (876 repositories). The framework significantly outperformed state-of-the-art weakly supervised models like WeSTClass and HierDataless.

  • Performance: On the Machine Learning dataset, HiGitClass outperformed the second-best approach by an average of 22.1% across F1 metrics.
  • Metadata Impact: Ablation studies showed that removing the HIN module caused a 15-28% drop in performance, confirming that metadata like user ownership is a critical signal. In the ML dataset, 62% of repositories shared by the same user belonged to the same leaf category.

Conclusion

HiGitClass provides a scalable solution for organizing the vast, unlabeled landscape of GitHub. By treating repository data as a heterogeneous network and generating synthetic training data, it bridges the gap between raw code and structured topic hierarchies. Future work includes integrating small amounts of existing labeled data and exploring semi-supervised loops to further refine embeddings.

Summary updated

BibTeX
@inproceedings{zhang2019higitclass,
  author = {Yu Zhang and Frank F. Xu and Sha Li and Yu Meng and Xuan Wang and Qi Li and Jiawei Han},
  title = {{HiGitClass: Keyword-Driven Hierarchical Classification of GitHub Repositories}},
  booktitle = {ICDM},
  year = {2019},
  doi = {10.1109/icdm.2019.00098},
}
Figure