Abstract
In recent years, many non-traditional classification methods, such as Random Forest, Boosting, and neural network, have been widely used in applications. Their performance is typically measured in terms of classification accuracy. While the classification error rate and the like are important, they do not address a fundamental question: Is the classification method underfitted? To our best knowledge, there is no existing method that can assess the goodness-of-fit of a general classification procedure. Indeed, the lack of a parametric assumption makes it challenging to construct proper tests. To overcome this difficulty, we propose a methodology called BAGofT that splits the data into a training set and a validation set. First, the classification procedure to assess is applied to the training set, which is also used to adaptively find a data grouping that reveals the most severe regions of underfitting. Then, based on this grouping, we calculate a test statistic by comparing the estimated success probabilities and the actual observed responses from the validation set. The data splitting guarantees that the size of the test is controlled under the null hypothesis, and the power of the test goes to one as the sample size increases under the alternative hypothesis. For testing parametric classification models, the BAGofT has a broader scope than the existing methods since it is not restricted to specific parametric models (e.g., logistic regression). Extensive simulation studies show the utility of the BAGofT when assessing general classification procedures and its strengths over some existing methods when testing parametric classification models.
Introduction: Beyond Accuracy
In modern machine learning, classifiers are predominantly judged by their accuracy. However, accuracy can be a deceptive metric. A model might achieve high accuracy while still failing to capture the underlying probability distribution of the data—a phenomenon known as underfitting.
Traditional "Goodness-of-Fit" (GOF) tests, such as the Hosmer-Lemeshow test, were designed for simple parametric models like logistic regression. They often fail when applied to complex "black-box" algorithms like Deep Learning or Random Forests. The Binary Adaptive Goodness-of-fit Test (BAGofT) fills this gap, providing a rigorous statistical framework to audit any binary classification procedure and determine if it has fundamentally missed the underlying patterns of the data-generating process.
The BAGofT Methodology
BAGofT uses a two-stage approach designed to actively search for regions where a model is failing. By separating the discovery of errors from the final statistical test, it maintains mathematical validity without "cherry-picking" bias.
- Data Splitting: The dataset is split into a training set and a validation set.
- Model Training: The classifier under assessment (the Procedure To Assess, or PTA) is trained on the training set.
- Adaptive Partitioning: This is the "secret sauce" of the methodology. A secondary model (typically a Random Forest) analyzes the residuals of the PTA on the training set to find specific regions in the covariate space where the model is struggling most.
- Testing: The covariate space is partitioned based on these "trouble spots." A Pearson-type test statistic is then calculated using the validation set. This produces a valid p-value that indicates whether the model's estimated probabilities match the true probabilities of the data.
The Power of Adaptive Partitioning
The effectiveness of a GOF test depends on how the data is grouped. If partitions are chosen poorly, positive and negative errors within a group can cancel each other out, hiding the model's defects.
As illustrated in the figure above, BAGofT’s adaptive partitioning (b) ensures that the bins are aligned with the regions where the model to test (orange dashed line) deviates from the true model (blue line). This maximization of the signal is what allows BAGofT to outperform classical tests in detecting missing non-linear effects or interactions.
Key Results and Applications
The researchers validated BAGofT across several diverse scenarios, demonstrating its utility in both research and clinical settings:
- Alzheimer’s Disease Study: In a Micro-RNA dataset, BAGofT rejected a 7-variable model that other tests accepted. It correctly identified that an 8th variable was missing; once added, the model passed the test.
- Medical Imaging: On a COVID-19 CT scan dataset, BAGofT revealed that a simple 1-neuron neural network was systematically defective, even though its raw accuracy was nearly as high as a more complex 7-neuron network.
- Interpretability: Because the test uses a secondary model to find trouble spots, it can identify which variables are causing the underfitting. For example, in Fashion MNIST tests, it identified that a model failed to understand the structural space between the legs in trouser images.
Conclusion
BAGofT provides a much-needed tool for auditing modern machine learning models. By providing a statistically valid measure of fit rather than just a performance score, it allows practitioners to move beyond accuracy and ensure their models truly reflect the complexities of the real-world data they aim to describe.
Summary updated