Abstract
In this paper, we develop a method which we call OnlineGCP for computing the Generalized Canonical Polyadic (GCP) tensor decomposition of streaming data. GCP differs from traditional canonical polyadic (CP) tensor decompositions as it allows for arbitrary objective functions which the CP model attempts to minimize. This approach can provide better fits and more interpretable models when the observed tensor data is strongly non-Gaussian. In the streaming case, tensor data is gradually observed over time and the algorithm must incrementally update a GCP factorization with limited access to prior data. In this work, we extend the GCP formalism to the streaming context by deriving a GCP optimization problem to be solved as new tensor data is observed, formulate a tunable history term to balance reconstruction of recently observed data with data observed in the past, develop a scalable solution strategy based on segregated solves using stochastic gradient descent methods, describe a software implementation that provides performance and portability to contemporary CPU and GPU architectures and integrates with Matlab for enhanced usability, and demonstrate the utility and performance of the approach and software on several synthetic and real tensor data sets.
Introduction
Tensors, or multi-dimensional arrays, serve as a foundational structure for representing complex, multi-faceted data—such as crime occurrences indexed by neighborhood, hour, and type. Canonical Polyadic (CP) decomposition is a primary tool for extracting interpretable latent patterns from these arrays. However, traditional CP methods face two significant hurdles in modern data science: the "Gaussian Assumption" and the "Big Data Wall."
Standard CP decomposition typically minimizes a least-squares objective, which implicitly assumes that data noise follows a Gaussian distribution. This is often inappropriate for real-world datasets like count data (Poisson) or binary events (Bernoulli). Furthermore, most decomposition algorithms are "batch-mode," requiring the entire tensor to be stored in memory. As data arrives in continuous streams, such as hourly traffic updates or daily crime reports, there is a critical need for algorithms that can update models incrementally without re-processing the entire historical archive. This paper introduces OnlineGCP, a framework designed to bring the flexibility of Generalized Canonical Polyadic (GCP) decomposition to the streaming data context.
The OnlineGCP Framework
Generalized Loss Functions
Unlike standard CP, OnlineGCP supports arbitrary loss functions tailored to the data's specific distribution. By utilizing negative log-likelihoods for various distributions—such as Poisson for taxi trip counts or Bernoulli for binary crime occurrences—the model produces more accurate and interpretable factors than traditional least-squares approaches.
Managing Temporal History
A central challenge in streaming decomposition is preventing the model from "forgetting" past patterns (catastrophic interference) while remaining responsive to new data. OnlineGCP addresses this through a tunable history term. The framework employs two primary mechanisms for stability:
- Reservoir Sampling: Maintaining a representative, small-scale subset of past observations.
- Frobenius Norm Penalty: A regularization term that prevents the new model state from drifting too drastically from the previous iteration, ensuring smooth transitions over time.
Optimization and Scalability
To maintain efficiency as new data "slices" arrive, the authors developed a segregated solve strategy. When a new time step is observed, the algorithm first optimizes for the temporal weights (identifying how the new slice relates to existing patterns) and subsequently updates the global factor matrices (the underlying latent structures).
To handle the massive scale and sparsity of real-world tensors, OnlineGCP utilizes Stochastic Gradient Descent (SGD) with ADAM optimization. A key innovation here is stratified sampling, which samples non-zero and zero entries separately. This ensures that the gradient updates are not overwhelmed by the vast number of zeros in sparse datasets, maintaining both accuracy and computational speed.
Implementation and Performance
The algorithm is implemented within the GenTen software package. By leveraging the Kokkos framework, the implementation achieves performance portability, allowing it to run efficiently on both multi-core CPUs and modern GPU architectures. This high-performance backend is integrated with MATLAB to ensure usability for the broader research community.
Experimental Results
The researchers validated OnlineGCP using both synthetic and large-scale real-world datasets:
- Synthetic Benchmarks: In tests using Gaussian and Poisson distributions, OnlineGCP successfully recovered "ground truth" patterns. The "KTensor Score"—a metric of recovery accuracy—remained high and stable throughout the data stream.
- NYC Taxicab Data: A 4-way tensor (Zone × Zone × Hour × Day) was modeled using a Poisson loss function, demonstrating the ability to track urban mobility patterns over 365 days.
- Chicago Crime Data: A 4-way tensor (Hour × Neighborhood × Crime Type × Day) was analyzed using a Bernoulli loss function, proving the method's efficacy on binary, sparse event data over 5,687 time steps.
In all cases, OnlineGCP achieved reconstruction losses nearly identical to "static" methods that processed the entire dataset at once, but with a fraction of the memory footprint.
Discussion and Future Work
OnlineGCP represents a significant step forward in real-time tensor analysis, particularly for non-Gaussian data. However, the authors identify several areas for continued development. The algorithm currently requires a "warm-start"—a small initial batch of data to initialize the factor matrices. Additionally, the framework involves several hyperparameters (learning rates, sampling rates, and history window sizes) that currently require manual tuning.
Future research will focus on automating hyperparameter selection and developing methods to detect "concept drift," where the underlying data distribution changes fundamentally over time. Such enhancements would allow OnlineGCP to adapt autonomously to shifting patterns in dynamic environments.
Summary updated