Algorithms for Generalized Cluster-wise Linear Regression

Young Woong Park, Yan Jiang, Diego Klabjan, Loren Williams · DOI

Abstract

Cluster-wise linear regression (CLR), a clustering problem intertwined with regression, is to find clusters of entities such that the overall sum of squared errors from regressions performed over these clusters is minimized, where each cluster may have different variances. We generalize the CLR problem by allowing each entity to have more than one observation, and refer to it as generalized CLR. We propose an exact mathematical programming based approach relying on column generation, a column generation based heuristic algorithm that clusters predefined groups of entities, a metaheuristic genetic algorithm with adapted Lloyd's algorithm for K-means clustering, a two-stage approach, and a modified algorithm of Sp{"a}th for solving generalized CLR. We examine the performance of our algorithms on a stock keeping unit (SKU) clustering problem employed in forecasting halo and cannibalization effects in promotions using real-world retail data from a large supermarket chain. In the SKU clustering problem, the retailer needs to cluster SKUs based on their seasonal effects in response to promotions. The seasonal effects are the results of regressions with predictors being promotion mechanisms and seasonal dummies performed over clusters generated. We compare the performance of all proposed algorithms for the SKU problem with real-world and synthetic data.

The Problem: Beyond Standard Clustering

In many domains, grouping similar entities is essential for effective analysis. Standard clustering techniques, such as K-means, typically group entities based on physical "distance" or static features. However, in complex environments like retail or engineering, behavior over time in response to external predictors is often more important than static similarity.

Consider a supermarket manager forecasting sales for hundreds of Stock Keeping Units (SKUs). Each SKU reacts differently to price discounts or seasonal shifts. Running individual regressions for every SKU often fails due to data sparsity per item, while grouping all SKUs together washes out critical nuances. Cluster-wise Linear Regression (CLR) addresses this by identifying clusters that minimize the total regression error across the group.

Conceptual comparison between CLR, Generalized CLR, and SKU Clustering

This paper introduces Generalized CLR (GCLR), which allows each entity (e.g., an SKU) to have multiple observations (e.g., weekly sales data). This creates a simultaneous optimization challenge: the best regression coefficients depend on the cluster assignments, and the best assignments depend on the regression results.

Methodology: Five Algorithmic Approaches

The authors prove that GCLR is NP-hard and propose five distinct strategies to solve it:

  1. Exact Column Generation (CG): A rigorous mathematical programming approach that iteratively solves a "Master Problem" and a "Pricing Problem" to find optimal clusters. While accurate, it is computationally intensive for large datasets.
  2. CG Heuristic: A streamlined version of the CG method that groups entities into small "blocks" to reduce the search space.
  3. GA-Lloyd: A hybrid metaheuristic combining a Genetic Algorithm (GA) with an adapted Lloyd’s algorithm. The GA explores the global search space to avoid local optima, while the Lloyd’s step provides rapid local refinement.
  4. Two-Stage Approach: The current industry standard, which clusters entities first using simple heuristics and then performs regressions. This serves as the baseline for comparison.
  5. Modified Späth Algorithm: An iterative exchange method that reassigns entities between clusters to minimize total error.
Algorithm 1: Column Generation (CG) for solving the master problem

Evaluation: Real-World and Synthetic Benchmarks

The researchers benchmarked these algorithms using two primary data sources:

  • Real-World Retail Data: Two years of sales and promotional data from a major supermarket chain, focusing on categories like "Cream" and "Medicines."
  • Synthetic Data: 70 generated instances designed to mimic real-world seasonal and promotional patterns, used to verify performance against known optimal solutions.

Key Insights and Results

The study reveals that simultaneity is key: performing clustering and regression concurrently is significantly more effective than the traditional two-stage approach. The two-stage method often groups items that appear similar but react differently to external factors, leading to inferior forecasts.

Key findings include:

  • GA-Lloyd Performance: The GA-Lloyd algorithm emerged as the most practical solution, achieving results within 2% of the mathematical optimum for small instances and vastly outperforming the two-stage baseline on large datasets.
  • Scalability: While the exact CG method provides a "gold standard," it struggles with more than 20 entities. In contrast, GA-Lloyd solved a 66-SKU problem in under 20 minutes, whereas CG failed to finish within 10 hours.
  • Meaningful Patterns: In the "Medicines" category (337 SKUs), GA-Lloyd identified intuitive seasonal patterns—such as U-shaped demand for cold medicine and inverted V-shaped demand for summer-related products—improving model fit by approximately 20% over the two-stage method.

Limitations and Future Work

Despite its success, the GCLR framework faces challenges. The number of clusters ($K$) must currently be predefined, as standard statistical tools like AIC or BIC often overestimate the necessary number of clusters. Additionally, computational intensity increases with the number of predictors. Future research will explore automatic cluster determination and "soft" assignments, where entities can belong to multiple clusters with varying probabilities.

Summary updated

BibTeX
@article{park2017algorithms,
  author = {Young Woong Park and Yan Jiang and Diego Klabjan and Loren Williams},
  title = {{Algorithms for Generalized Cluster-wise Linear Regression}},
  journal = {INFORMS J. Comput.},
  year = {2017},
  doi = {10.1287/ijoc.2016.0729},
}
Figure