Abstract
In safety-critical applications, identifying when a machine learning model is likely to fail is as crucial as the prediction itself. We present NeighborAgg (Adaptive Neighborhood Aggregation), a post-hoc, model-agnostic method that determines the trustworthiness of a classifier's output. By adaptively combining a sample's neighborhood information with the classifier's internal logic, NeighborAgg significantly outperforms existing methods in identifying misclassifications and detecting mislabeled data across tabular and image datasets without requiring expensive model retraining.
Introduction
Modern neural networks, while highly accurate, are notoriously overconfident. In domains like autonomous driving or medical diagnosis, relying on the standard "softmax" output as a confidence score can be dangerous, as models often assign high probabilities to incorrect guesses. Existing solutions typically require retraining the model or rely on rigid, hand-crafted functions like the "Trust Score" that fail to capture complex data distributions. NeighborAgg bridges this gap by introducing a learnable, flexible scoring system that works with any pre-trained classifier.
Methodology: Adaptive Neighborhood Aggregation
NeighborAgg extracts two distinct types of features for any given input sample to compute a trustworthiness score:
- Neighborhood Features ($h$): The algorithm identifies the $K$ nearest neighbors in the training set for every possible class. It calculates similarity using a Laplacian kernel, creating a vector that describes how well the sample fits within the local neighborhood of each class.
- Classifier Output Features ($p$): This utilizes the probability vector (softmax) or logits produced by the pre-trained base classifier.
These features are fed into a simple, single-layer neural network that learns the optimal weighting between the model's internal confidence and the external neighborhood evidence. Theoretically, NeighborAgg acts as a generalized one-hop Graph Convolutional Network (GCN), providing a solid mathematical foundation for its ability to capture varying similarities within and between classes.
Key Insights: Why Neighborhoods Matter
The core innovation of NeighborAgg is the recognition that model confidence and neighborhood density are complementary signals. In "clean" regions of the feature space, neighborhood consistency is a strong indicator of trust. In "noisy" regions, the model's internal logic becomes more critical. NeighborAgg learns this trade-off automatically.
Unlike methods that only look at the distance to the nearest class, NeighborAgg considers relationships across all classes. This allows it to learn that a "Cat" sample appearing near a "Dog" neighborhood is statistically more trustworthy than a "Cat" appearing near an "Airplane" neighborhood, reflecting the inherent semantic relationships in the data.
Experimental Results
NeighborAgg was evaluated across seven UCI tabular benchmarks and standard image datasets (MNIST, CIFAR-10). It consistently achieved state-of-the-art performance, with an average gain of 7.63% in APM (Area under the Precision-Recall curve for Misclassification) on tabular data.
Beyond misclassification detection, a variant called NeighborAgg-CMD was tested on the Quora Insincere Questions dataset. It successfully identified training samples that were incorrectly flagged by human annotators, demonstrating its utility as a robust tool for data cleaning and mislabel detection.
Conclusion and Future Work
NeighborAgg provides a computationally efficient and robust way to quantify model trust. While its performance is dependent on the quality of the base classifier's feature space, its adaptive nature makes it highly effective across diverse data types. Future work will focus on making these trustworthiness scores more explainable, helping users understand specifically why a prediction is flagged as untrustworthy.
Summary updated