Class-Mean Features (CMF) Classifier
- The Class-Mean Features (CMF) classifier is a method that computes class centroids as decision anchors using normalized mean vectors.
- It employs techniques like minimum-distance normalization and closed-form linear solutions to boost fine-grained recognition, few-shot learning, and machine unlearning.
- CMF classifiers support drift detection and self-training through stable prototype-based architectures, achieving notable accuracy and efficiency improvements.
The class-mean features (CMF) classifier is a broad family of classification approaches in which the prototype or centroid of each class—computed as the mean of input features or latent embeddings for that class—serves as the explicit anchor for decision-making. CMF classifiers arise in both classical pattern recognition and contemporary deep learning, with applications spanning representation analysis, fine-grained recognition, few-shot learning, machine unlearning, and monitoring of distributional drift.
1. Mathematical Foundations and Core Algorithms
At the core of CMF classification lies the computation of the class mean vector. For a dataset with classes, define as the set of feature vectors belonging to class . The class mean is
Classification can proceed by assigning an input to the class whose mean is closest to under a chosen metric, typically Euclidean distance or cosine similarity.
Two primary techniques for generating last-layer weights from class means are:
- Minimum-distance normalization ("min-dist"): , associating each class with a normalized mean direction.
- Closed-form linear solution: , where stacks all input vectors and 0 stacks class sums, yielding explicit weights without iterative optimization (Wong, 2019).
In deep models, CMFs are typically computed in the latent space after pooling, and used as either direct classifier weights or as prototypes for nearest-centroid decision rules.
2. CMF in Representation Learning and Fine-Grained Classification
Fine-grained recognition leverages class-mean feature modules to exploit inter-class relationships. The Categorical Memory Network (CMN) integrates an external memory matrix 1, with each row 2 storing the class-3 prototype as a moving average: 4 where 5 is the feature representation of 6, and 7 the memory update coefficient (e.g., 8) (Deng et al., 2020).
For a query, similarities 9 are computed and normalized by softmax with temperature 0, producing an attention vector 1. The response feature is
2
A combined feature 3 is then classified by a learned linear layer. This results in enhanced discriminative power and has been empirically validated to improve accuracy by 2.4--3.8% on fine-grained benchmarks relative to conventional CNNs, with minimal computational overhead (Deng et al., 2020).
3. Machine Unlearning and Representation Alignment
CMF classifiers are pivotal in recent machine unlearning work, particularly for enforcing feature-classifier alignment and evaluating true representational forgetting. In the context of frozen feature extractors 4, the CMF classifier head is constructed as: 5 The classifier weight matrix 6 aligns precisely with class means at every epoch (Gao et al., 9 Apr 2026).
During unlearning, the head is rebuilt from current means after each update to prevent the output-level "forgetting" achieved via merely misaligning weights. This approach enforces that genuine representation-level forgetting occurs in the feature extractor itself. Empirical evaluations show CMF-driven unlearning can reduce feature-level recoverability (measured via linear probes or nearest-centroid classification) by 20--30 percentage points, in contrast to conventional output-flipping, which leaves feature discriminability essentially intact (Gao et al., 9 Apr 2026).
4. CMF Approaches in Few-Shot and Meta-Learning Contexts
In few-shot and almost zero-shot meta-learning, class-mean prototypes provide compact task priors. For a task 7 with a support set 8, the mean embedding for class 9 is
0
Classification on the query set is typically performed via nearest centroid in embedding space: 1
The Canonical Mean Filter (CMF) module [Editor's term: "Canonical Mean Filter" refers to the adaptive mean-stabilization architecture of (Li et al., 2022)] enhances stability by mapping arbitrary support sets into canonical prototypes using channel-wise scaling via learned attention extracted at each layer. After training, the method permits removing the CMF and adaptation networks, yielding a 40.48% parameter reduction at test time without sacrificing, and at times improving, accuracy across Meta-Dataset domains (Li et al., 2022). CMF drastically reduces within-class variance (e.g., threefold for QuickDraw) while preserving inter-class separation.
5. Self-Monitoring, Drift Detection, and Self-Training
Class means serve as stable anchors for model monitoring and adaptation in unlabeled settings. The E-Marker algorithm computes the discrepancy between training and test class means: 2 where 3 is the center of predicted class 4 in the unlabeled batch and 5 the training mean. The overall E-Marker 6 tracks model drift; exceeding a threshold signals the need for model retraining or upstream intervention (Wong, 2019).
For self-training, pseudo-gradients defined by
7
adjust classifier weights based on the soft assignment of predictions on unlabeled data, facilitating closed-form or few-step semi-supervised learning (Wong, 2019).
6. Theoretical Context: Optimality and Neural Collapse
Under Gaussian class-conditional assumptions with shared covariance, the Bayes-optimal linear discriminant depends solely on class means, providing statistical justification for CMF classifiers (Wong, 2019).
Neural collapse phenomena observed in deep networks (Gao et al., 9 Apr 2026) further motivate CMF-based designs. At the collapse point, (1) intra-class features concentrate at their means; (2) the centered class means form a simplex equiangular tight frame; (3) last-layer weights align with these means; and (4) the classifier is equivalent to the nearest-centroid rule. CMF classifier heads directly encode this structure by re-centering and normalizing means at every update. This enforces ongoing alignment and eliminates the feature-classifier misalignment loophole exploited in naive unlearning.
7. Practical Considerations, Computational Properties, and Limitations
The computational expense of mean feature computation is 8, and classifier construction via minimum-distance normalization is 9 for 0 classes in 1-dimensional space. For the closed-form linear moment-matching variant, the requirements are 2 for matrix inversion and 3 storage for feature matrices. CMF classifiers are memory-efficient, requiring only 4 mean vectors and, optionally, 5 covariance structures (Wong, 2019).
While CMF classifiers offer closed-form solutions, robust drift detection, and self-training capabilities, their linearity limits their efficacy for nonlinearly-separable classes unless deep embeddings or kernelizations are introduced. Sensitivity to feature scaling and the lack of explicit modeling of class covariances also constrain their practical range. However, integration with deep feature extractors and meta-learning architectures overcomes many of these issues, enabling application to modern representation learning, meta-learning, and unlearning scenarios (Deng et al., 2020, Gao et al., 9 Apr 2026, Li et al., 2022).
| Method / Paper | Core CMF Formulation | Distinctive Trait |
|---|---|---|
| (Wong, 2019) | Classical mean vector, linear weights | Direct weight computation, drift detection, self-training |
| (Deng et al., 2020) | Memory module with moving prototype | Attention-weighted feature augmentation for fine-grained recognition |
| (Gao et al., 9 Apr 2026) | Centered and normalized means, strict head-feature alignment | Enforces true unlearning at the representation level |
| (Li et al., 2022) | CMF as channel-wise adaptive filter | Stable prototypes, parameter-efficient meta-learning |
Empirical results across these studies confirm that CMF classifiers, despite simplicity, provide a versatile and theoretically robust core for a wide range of modern machine learning problems.