Event2Vec library introduces additive event embeddings with exact linear score decomposition

·2026.10.14 19:16

Key point

The open-source library supports non-commutative geometric spaces like hyperbolic and SO(n) rotations to preserve event order in sequence modeling.

Details

Event2Vec is a new open-source library for learning embeddings of discrete event sequences, such as purchases, logs, and clinical codes. The core mechanism defines a history as the running sum of event vectors, allowing any linear model on top of the history to decompose exactly into per-event terms. This structure enables interpretable scoring, where a churn or risk score can be broken down into individual event contributions.

Core Mechanism and Training

The library uses self-supervised next-event prediction combined with a reconstruction term that ensures the difference between consecutive histories recovers the specific event vector. While vector addition in Euclidean space is commutative, the training process does not enforce commutativity, allowing the model to learn directional relationships. The library explicitly supports non-commutative geometric spaces to handle sequence order and structure:

  • Hyperbolic (Möbius addition): Designed for hierarchical structures.
  • κ-stereographic: Offers a curvature dial ranging from hyperbolic through flat to spherical.
  • Spherical: Supports cyclic structures.
  • SO(n) rotations: Non-commutative rotations where order changes the endpoint.
  • Heisenberg group: Records order via a signed-area coordinate while maintaining the same endpoint.

Implementation and Availability

Event2Vec is available under the MIT license via GitHub and pip (pip install event2vector). It features a scikit-learn-style API with fit and transform methods, along with most_similar functionality similar to gensim. The backend is built on PyTorch and supports CPU, CUDA, and MPS execution. The project originated from root-cause analysis needs at the Advanced Light Source at Berkeley Lab, where traditional Word2Vec approaches lacked necessary directionality for fault sequences.

This summary was generated automatically by AI. Check the original for the author's claims and context. Copyright belongs to the original author.

Our guide explains how the AI works. Report summary errors, attribution issues, or removal requests via Contact.