Abstract
Formal explainability in machine learning ensures that identified features are sufficient to maintain a model's prediction. While Prime Implicant (PI) explanations provide such guarantees, they have historically been computationally expensive for models like Naive Bayes Classifiers (NBCs). This paper introduces a novel approach by reducing NBCs to Extended Linear Classifiers (XLCs) and mapping the explanation search to a simplified knapsack problem. We present algorithms that achieve log-linear time for finding single explanations and polynomial delay for full enumeration, significantly outperforming previous state-of-the-art methods.
Introduction
As machine learning models are increasingly deployed in high-stakes scenarios, the demand for "explainability" has intensified. Popular heuristic tools like SHAP or Anchor provide explanations but lack formal guarantees that the highlighted features are sufficient to lock in a prediction. In contrast, non-heuristic formal explanations, specifically Prime Implicant (PI) explanations, identify a minimal set of feature-value pairs such that the model's prediction remains unchanged regardless of other feature values.
Previously, computing PI-explanations for Naive Bayes Classifiers (NBCs) was considered computationally expensive, often requiring the compilation of models into complex logic structures like Sentential Decision Diagrams (SDDs), which can scale exponentially. This research addresses the need for a more efficient, direct method to explain these widely used linear models.
Methodology: From Naive Bayes to Linear Classifiers
The authors introduce the Extended Linear Classifier (XLC), a generalization capable of handling both real-valued and categorical features. A key contribution of this work is the mathematical reduction of NBCs to XLCs, allowing the problem to be treated within a linear framework.
The core technical breakthrough involves transforming the search for a PI-explanation into a minimization version of the knapsack problem. While the general knapsack problem is NP-hard, the authors observe that in this specific context—where the goal is to minimize the number of features—the "costs" associated with each feature are uniform (equal to 1).
This observation enables two efficient algorithms:
- Greedy Search: By sorting feature "slack" values (representing the potential impact of changing a feature), a smallest PI-explanation can be found in log-linear time ($O(n \log n)$).
- Backtracking DFS: For enumerating all possible PI-explanations, a depth-first search with specific pruning rules ensures polynomial delay. This prevents the computational "hangs" typical of exponential algorithms.
Experimental Evaluation
The researchers evaluated their tool, XPXLC, across 37 publicly available datasets from the UCI Machine Learning Repository, Kaggle, and the Penn Machine Learning Benchmarks. Qualitative analyses were performed on specific datasets such as Adult (census data) and Spambase (email classification).
Key Results and Insights
The experimental results demonstrate that XPXLC is orders of magnitude faster than previous methods. It can enumerate up to one million explanations for a single instance in under 12 seconds, with an average complete enumeration time of just 0.23 seconds. Furthermore, while the previous state-of-the-art (STEP) failed to compile 75% of tested NBCs due to memory or time limits, XPXLC handled all instances with ease.
The study also used these formal explanations to audit heuristic tools. It found that while SHAP and Anchor often identify important features, there are instances where they have zero overlap with formal PI-explanations, potentially providing misleading justifications for predictions. This highlights the importance of formal methods in validating model interpretability.
Limitations and Future Work
While the polynomial-time guarantees are a significant advancement, they apply specifically to linear classifiers and Naive Bayes. More complex models, such as Deep Neural Networks or Random Forests, still require more computationally intensive formal methods. Additionally, the reduction of NBCs to XLCs assumes the standard Naive Bayes property of feature independence. Future research may explore extending these efficient algorithms to other model classes with linear-like properties, such as latent-tree classifiers or specific decision tree structures.
Summary updated