SocialED: A Python Library for Social Event Detection

Kun Zhang, Xiaoyan Yu, Pu Li, Hao Peng, Philip S. YuarXiv 2024 · DOI · arXiv

Introduction

Social media platforms generate a continuous stream of information, making the identification of "noteworthy events"—such as natural disasters or breaking news—a significant challenge. While numerous models for Social Event Detection (SED) have been developed, the field has historically suffered from fragmentation. Researchers often face incompatible codebases, varying data formats, and inconsistent evaluation metrics, hindering the benchmarking of new models and their deployment in industrial settings.

SocialED is a new open-source Python library designed to bridge this gap. It provides a "one-stop-shop" for SED by integrating 19 state-of-the-art algorithms and 14 diverse datasets into a single, scikit-learn-style API. By standardizing the SED workflow, SocialED facilitates both academic research and real-world application.

Unified API and System Architecture

The library is built on a modern tech stack, including PyTorch, Hugging Face Transformers, and scikit-learn, with a focus on modularity and ease of use. The core of SocialED is its unified API design, which follows a predictable four-step workflow:

  1. preprocess(): Handles data preparation, including tokenization and graph construction.
  2. fit(): Trains the selected detection algorithm.
  3. detection(): Predicts events on new or test data.
  4. evaluate(): Provides standardized performance metrics.
SocialED pipeline and API inclusion

This modular design allows components like graph construction to be decoupled from specific models, enabling researchers to mix and match preprocessing techniques with different architectures.

Comprehensive Algorithms and Datasets

SocialED includes 14 widely-used datasets covering general events (e.g., Event2012, MAVEN), crisis management (e.g., CrisisLexT26, HumAID), and multilingual contexts (e.g., ArabicTwitter). These datasets vary in scale from 3,000 to over 85,000 texts.

The library tracks the evolution of the field, supporting 19 algorithms across various backbones, including Topic Modeling (LDA), Word Embeddings (Word2Vec, GloVe), Pre-trained Language Models (BERT, SBERT), and Graph Neural Networks (KPGNN, GCN).

Summary of supported algorithms and datasets in SocialED

Software Quality and Production Readiness

Unlike many academic projects, SocialED emphasizes high software engineering standards. It features 99% code coverage, continuous integration via GitHub Actions, and strict adherence to PEP 8 style guides. This ensures the library is reliable and ready for production environments. Furthermore, the library is hardware-agnostic, optimized for both CPU and GPU environments to handle large-scale social media streams efficiently.

Conclusion and Future Directions

While SocialED provides a comprehensive foundation, future work will focus on expanding its scope to more languages and cultures, incorporating automated machine learning (AutoML) for hyperparameter optimization, and supporting real-time streaming data for early warning systems.

Availability: SocialED is publicly available on GitHub and can be installed via PyPI (pip install socialed). Detailed documentation is hosted on Read the Docs.

Summary updated

Abstract

SocialED is a comprehensive, open-source Python library designed to support social event detection (SED) tasks, integrating 19 detection algorithms and 14 diverse datasets. It provides a unified API with detailed documentation, offering researchers and practitioners a complete solution for event detection in social media. The library is designed with modularity in mind, allowing users to easily adapt and extend components for various use cases. SocialED supports a wide range of preprocessing techniques, such as graph construction and tokenization, and includes standardized interfaces for training models and making predictions. By integrating popular deep learning frameworks, SocialED ensures high efficiency and scalability across both CPU and GPU environments. The library is built adhering to high code quality standards, including unit testing, continuous integration, and code coverage, ensuring that SocialED delivers robust, maintainable software. SocialED is publicly available at \url{https://github.com/RingBDStack/SocialED} and can be installed via PyPI.
BibTeX
@misc{zhang2024socialed,
  author = {Kun Zhang and Xiaoyan Yu and Pu Li and Hao Peng and Philip S. Yu},
  title = {{SocialED: A Python Library for Social Event Detection}},
  year = {2024},
  eprint = {2412.13472},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2412.13472},
}
Figure