The Gaussian classifier, often referred to as the Gaussian Naive Bayes when assuming feature independence, or the more general Gaussian Mixture Model (GMM), which does not assume feature independence and instead uses full covariance matrices, can be used for classification tasks when each class can be modeled with a Gaussian distribution.
However, there are a couple of concerns with training such a classifier on your dataset, particularly when it comes to using full covariance matrices:
-
Sufficient Data: If you have only 100 samples per digit class, and each image is 28x28 pixels, this means you have 784 features. To estimate the parameters of a Gaussian distribution (the mean and covariance matrix), you need a sample size that is significantly larger than the number of features. Otherwise, the estimated covariance matrix may not be accurate or even invertible, which is required to compute the likelihood of a new sample.
-
Curse of Dimensionality: With 784 features, you're facing a high-dimensional space, and a classifier would ideally require a vast number of training samples to adequately capture the underlying distribution within this space. A small training set means that the classifier may not generalize well to new, unseen data, leading to overfitting.
-
Full Covariance Matrix Complexity: A full covariance matrix for 784-dimensional data is a 784x784 matrix, which requires estimating 784*(784+1)/2 = 307,720 independent values. With only 100 samples per class, you do not have enough data to reliably estimate these many parameters.
That said, there are techniques to mitigate these challenges:
-
Dimensionality Reduction: Techniques such as PCA (Principal Component Analysis) can be used to reduce the dimensionality of the feature space, which can make the estimation of covariance matrices more feasible with fewer samples.
-
Regularization of the Covariance Matrix: Adding a regularization term to the covariance matrix can help to make it invertible. For example, by adding a small value along the diagonal (a technique known as shrinkage), you can ensure that the matrix is positive definite and thus invertible.
-
Use Diagonal Covariance Matrices: By assuming that the features are conditionally independent given the class (as in Naive Bayes), you can simplify the model by using diagonal covariance matrices, where the covariances off the diagonal are zero. This reduces the number of parameters drastically.
-
Pool the Covariance Matrices: If the assumption that each class has its own covariance matrix is too strong, you could pool the covariances across all classes to estimate a shared covariance matrix, significantly reducing the number of parameters to be estimated.
In conclusion, while it is theoretically possible to train a Gaussian classifier with full covariance matrices for your dataset, the limited number of samples relative to the dimensionality of the feature space makes it challenging. To improve classifier performance, you would need to employ techniques to manage the high dimensionality and to ensure that the covariance matrices can be accurately estimated with the available data.