completed Jan 2024 - Jul 2025

ScalableXplain: Explainable AI for Scalable Machine Learning

#Explainable AI #Distributed Computing #Apache Spark #Clustering #Decision Trees #Big Data
ScalableXplain: Explainable AI for Scalable Machine Learning

Overview

As machine learning systems are increasingly deployed in high-stakes domains on large-scale data, interpretable and scalable explanation methods have become critical. Most explainable AI (XAI) techniques, such as LIME and SHAP, target supervised models and provide local explanations, leaving unsupervised methods like k-means clustering largely opaque. The Iterative Mistake Minimization (IMM) algorithm offers a promising global, post-hoc explanation by building a decision tree that approximates k-means cluster assignments, but it is limited to single-node environments and cannot handle large datasets because of memory and computational constraints.

This project, co-supervised by Dr. Sumanaruban Rajadurai, introduces D-IMM (Distributed Iterative Mistake Minimization), the first distributed implementation of IMM, built in Scala on Apache Spark. D-IMM discretises each feature into quantile bins augmented with cluster-centre thresholds, computes mistake histograms in parallel across Spark executors with local aggregation to minimise communication, evaluates candidate splits for every tree node in parallel, and grows the explanation tree iteratively under the coordination of the driver. These design choices allow D-IMM to scale with data volume and cluster complexity while preserving high fidelity to the original clustering. Alongside the algorithm, the team developed ScalableXplain, a unified XAI package providing KernelSHAP, LIME and IMM for both single-node Python and distributed PySpark environments.

Motivation & Objectives

AI is increasingly integrated into critical fields where explanations of algorithmic results are essential for trust, compliance and oversight, and technological advances have led to a massive increase in data generation, creating a growing demand for distributed machine learning. Yet current XAI implementations for distributed environments are limited, and none natively support explaining unsupervised clustering at scale. The project pursued the following objectives:

Scalable Explanation Algorithm – To develop a scalable and explainable AI algorithm for k-means clustering tailored to distributed systems.

Rigorous Evaluation – To evaluate the proposed algorithm in terms of computational scalability and explanation quality on large benchmark datasets, using execution time, k-means cost and mistake-minimisation accuracy.

Unified XAI Package – To create a unified XAI package for PySpark and Python containing the novel algorithm and existing explanation methods, with low-code visualisation support.

Impact & Results

Performance

D-IMM was evaluated on the HIGGS (11 million instances, 28 features) and SUSY (5 million instances, 18 features) datasets from the UCI repository using Google Cloud Dataproc clusters with 2, 4 and 8 workers, against the ExKMC single-node IMM implementation. For the largest dataset of 11 million instances, D-IMM with 8 executors achieved over a 3x speedup over the single-node implementation. On HIGGS subsets, execution time fell from 44 s to 15 s at 1 million instances (scalability factor 2.93x) and from 208 s to 65 s at 5 million instances (3.20x), with factors exceeding 3.2x at 3 and 4 million instances. Explanation quality was preserved: on HIGGS (k = 10) mistake rates were highly comparable to IMM, with D-IMM lower at 3 million instances (18.39% vs. 18.83%) and identical at 5 million (27.01%), while on SUSY with k = 4 and 1 million rows D-IMM reduced the mistake rate from 28.36% to 21.17%. D-IMM also lowered the surrogate cost for every HIGGS subset (for example, from 39.12 to 19.52 x10^6 at 1 million rows) and reduced the recomputed k-means cost (from 23.15 to 19.55 x10^6 at 5 million rows), indicating that its trees closely mirror the geometry of the original clustering.

Key Contributions

D-IMM Algorithm

The first distributed implementation of Iterative Mistake Minimization for explaining k-means clustering, combining histogram-based binning, distributed mistake-statistic aggregation and parallel split evaluation on Apache Spark.

Large-Scale Empirical Evaluation

A comprehensive evaluation on datasets of up to 11 million instances measuring mistake percentage, runtime, scalability factor, surrogate cost and k-means cost against the single-node IMM baseline.

ScalableXplain Library

A modular XAI package that unifies KernelSHAP, LIME and IMM under a common interface for single-node and distributed settings, with low-code visualisation of feature attributions and explanation trees.

Research Publications

A survey on post-hoc XAI for distributed machine learning systems submitted to the Journal of Big Data, and a D-IMM paper submitted to FAIEMA 2025.

Real-world Impact

D-IMM brings scalable, global explanations to clustering, making interpretable unsupervised learning feasible within modern big data pipelines. By removing the single-node limitations of IMM while preserving its mistake-based objective, it allows practitioners to audit and understand k-means models trained on millions of records, which is particularly valuable in regulated domains such as healthcare, finance and scientific computing. The ScalableXplain library lowers the barrier to adopting explainability on distributed platforms, and planned extensions include ExKMC-style constraints and streaming variants of D-IMM that adapt incrementally as new data arrives.

Gallery

Team ScalableXplain presenting D-IMM at the Final Year Project Showcase 2025

Team ScalableXplain presenting D-IMM at the Final Year Project Showcase 2025

The project team at the Department of Computer Science and Engineering, University of Moratuwa

The project team at the Department of Computer Science and Engineering, University of Moratuwa

Project poster: D-IMM, a scalable threshold tree approach for post-hoc clustering explanation

Project poster: D-IMM, a scalable threshold tree approach for post-hoc clustering explanation

Project Team

Inuka Ampavila

Inuka Ampavila

Undergraduate Researcher

Focused on software and data engineering for distributed explainable AI, including the ScalableXplain library.

Bojitha Liyanage

Bojitha Liyanage

Undergraduate Researcher

Focused on machine learning and efficient, scalable algorithms for explaining clustering models.

Saadha Salim

Saadha Salim

Undergraduate Researcher

Contributed to the design and evaluation of distributed explainability methods for k-means clustering.