To address the underlying question, we need to understand the concept of covariance matrices in the context of Gaussian classifiers and the 'curse of dimensionality':
-
Diagonal vs. Full Covariance Matrices:
- In a Gaussian classifier, a covariance matrix represents how features of the data vary together. In the context of image pixels, a full covariance matrix would consider how every pixel's intensity is related to every other pixel's intensity. Thus, for a 28x28 pixel image, the full covariance matrix would have 784x784 entries.
- A diagonal covariance matrix simplifies this by assuming that all the features (pixels) are independent of each other and only the variance of each feature is taken into account. Each off-diagonal element, which represents feature correlations, is assumed to be zero. Hence, for the 28x28 image, the diagonal covariance matrix will only have 784 entries which are the variances of the individual pixel intensities.
-
Curse of Dimensionality:
- The 'curse of dimensionality' refers to various phenomena that occur when analyzing and organizing data in high-dimensional spaces, often those with more dimensions than the number of samples.
- A prominent issue is that the volume of the space increases so quickly with the number of dimensions that the available data become sparse. This sparsity is problematic for any method that requires statistical significance.
- When dealing with full covariance matrices, estimating the 784x784=614,656 unique entries in the matrix from only 100 samples per digit is unrealistic because there isn't enough data to provide a reliable estimate for each parameter. This can lead to a covariance matrix that is singular or near-singular, which in turn can cause numerical issues like a LinAlgError in Python when attempting to compute its inverse as part of many Gaussian classification algorithms.
-
Increasing Training Samples:
- When the number of training samples is increased to around 6000 per digit, there is much more data available to estimate the covariance matrix. This superior dataset size can lead to a more accurate and reliable estimation of the full covariance matrix.
- With a more reliable full covariance matrix estimate, the classifier can now model the correlation between different pixel intensities properly, which, in turn, can enhance the classification performance because the classifier can now utilize the inter-pixel dependence information that the diagonal covariance matrix was neglecting.
-
Improved Performance with Full Covariance Matrices:
- Thus, with sufficient data, modeling the full complexity of the data with a full covariance matrix can capture nuances in the data that a diagonal covariance matrix doesn't, potentially leading to better accuracies.
- This happens because real-world data often have complex inter-feature dependencies, and a full covariance Gaussian classifier can model these relationships, therefore providing a richer and more discriminative model of the data.
In summary, when the sample size is small relative to the number of features (in this case, pixels), a classifier with a full covariance matrix is likely to overfit and be numerically unstable because it tries to estimate too many parameters from too little data (curse of dimensionality). Conversely, with a sufficiently large dataset, a full covariance classifier becomes preferable as it can more fully capture the relationships between features, leading to improved classification accuracy.