Skip to Content
SignalsSignals
  • Article
  • Open Access

1 September 2026

14 Pages

AdaLMNN: Adaptive Large Margin Nearest Neighbor Metric Learning for EEG-Based Emotion Recognition

,
,
,
and
1
School of Instrument Science and Engineering, Harbin Institute of Technology, Harbin 150001, China
2
School of Pharmacy and Medical Laboratory Science, Jiangsu Health Vocational College, Nanjing 211800, China
*
Author to whom correspondence should be addressed.

Abstract

Electroencephalography (EEG)-based emotion recognition provides an important physiological basis for affective brain–computer interfaces. However, high-dimensional EEG features vary across trials, sessions, and subjects. Euclidean distance and conventional source-only LMNN cannot jointly learn a discriminative geometry and align cross-domain emotion distributions. To address this problem, we propose Adaptive Large Margin Nearest Neighbor (AdaLMNN), an unsupervised domain-adaptation framework for EEG emotion recognition. AdaLMNN learns a shared Mahalanobis projection through normalized large-margin discrimination, adaptive margins, and refreshed source neighborhoods. It further uses confidence-guided target pseudo-labels, class-balanced conditional alignment, and scale regularization with scheduled optimization to reduce source–target mismatch without using target ground-truth labels. We evaluated AdaLMNN on synthetic data and the SEED and SEED-IV datasets using SVM, KNN, and MLP under three protocols. AdaLMNN substantially improved EEG emotion-classification performance, particularly under within-session and session-level shifts. Although cross-subject gains remained dataset- and classifier-dependent, the results demonstrate the potential of AdaLMNN as an interpretable and extensible representation-learning module for EEG emotion recognition under heterogeneous recording conditions.

1. Introduction

Electroencephalography (EEG)-based emotion recognition offers a direct physiological window into affective states and has been widely adopted in neural rehabilitation, psychological assessment, and human–computer interaction [1,2,3]. Unlike facial expressions or vocal intonation [4], EEG provides a direct physiological measurement of neural activity and is less susceptible to deliberate masking. Reliable recognition nevertheless remains difficult because emotional patterns are distributed across high-dimensional features and vary across subjects and recording sessions. These differences change the scale and distribution of EEG features, so patterns learned from one subject or session may not work well for another. The learned representation should therefore distinguish emotional classes while remaining robust to variations across subjects and sessions.
Current EEG emotion-recognition pipelines generally comprise signal preprocessing, feature extraction, and classification. Preprocessing typically includes re-referencing, baseline correction, band-pass or notch filtering, downsampling, and artifact removal using independent component analysis or wavelet-based methods [5]. These steps suppress ocular, muscular, and power-line interference before emotion-related information is extracted. Early feature pipelines characterized EEG signals using time-domain statistics, band power, power spectral density, and nonlinear complexity measures. Differential entropy (DE) remains widely used because it summarizes band-specific EEG activity and performs well on SEED-type datasets [6,7]. Recent methods increasingly combine time–frequency decomposition with electrode topology, using wavelet subbands or differential-entropy features to construct structured spatial–spectral representations [8,9]. Classification methods have progressed from KNN, SVM, decision trees, and ensemble learning to CNN and recurrent architectures that jointly learn spatial and temporal dependencies. Graph neural networks represent electrodes as interacting nodes, while Transformer models capture long-range dependencies across channels and time [10,11]. Neural architecture search has also been introduced to automate model design for EEG emotion recognition [12]. More recently, domain-adaptation models have aimed to reduce subject and session differences during classification [13,14].
Recent EEG domain-adaptation research has moved beyond global distribution matching toward multi-source transfer, graph-structured representation learning, pseudo-label-driven alignment, and source-free adaptation. Multi-source methods exploit complementary information from several participants or sessions, while inter-domain sample hybridization constructs mixed-domain samples to strengthen class-conditional alignment [15]. Selective graph domain-adaptation networks instead represent spatial and functional relationships among EEG channels, allowing regional brain states and functional connectivity patterns to be adapted jointly across subjects [16]. Another line of work improves target-domain supervision without requiring target annotations. Reliable pseudo-label iteration progressively filters and updates target predictions during adversarial training, whereas dynamic distribution alignment adjusts the relative emphasis on marginal and conditional discrepancies as optimization proceeds [17,18]. Proxy-domain guidance extends adaptation to multi-source-free settings without retaining raw source-domain EEG data [19]. Adaptive graph convolution and dual pseudo-label adversarial learning further refine learned connectivity or cross-check target assignments under cross-subject and cross-session shifts [20,21]. Collectively, these approaches emphasize deep feature extraction, graph neural architectures, adversarial optimization, or source-free model transfer. They often provide limited direct control over local neighborhood geometry and class-specific distance relationships. This leaves a complementary need for domain adaptation that makes neighborhood relations and class-specific distance structure explicit. AdaLMNN addresses this need through a shared Mahalanobis projection that couples adaptive large-margin neighborhood discrimination with confidence-guided class-conditional alignment. Beyond distribution alignment, recognition performance also depends on how well the resulting feature space organizes emotional patterns. An effective representation should form compact neighborhoods for the same emotion while preserving separation between different emotions across subjects and sessions. However, Euclidean distance, commonly used to define neighborhood relationships, assigns equal importance to all dimensions and ignores correlations among EEG features. Metric learning addresses this limitation by learning a task-specific Mahalanobis geometry, providing a natural basis for large-margin neighborhood optimization. Large Margin Nearest Neighbor (LMNN) metric learning improves local discrimination by pulling designated same-class neighbors together and pushing different-class impostors beyond a margin [22].
When applied to EEG emotion recognition, however, conventional LMNN remains supervised and source-centered, assuming that source-domain neighborhoods are also appropriate for the target domain. Its fixed margin may not accommodate fold-dependent changes in EEG feature scale and class geometry. Under substantial subject or session shifts, excessive contraction around selected EEG neighbors may suppress meaningful within-class substructure, while fixed repulsion may alter the relative arrangement among emotion classes. This is a setting-specific risk arising from heterogeneous EEG distributions rather than an inherent limitation of LMNN in every application. Moreover, conventional LMNN provides no explicit mechanism for matching corresponding source and target emotion classes. Direct marginal alignment is also insufficient because it can mix class modes when class proportions or conditional distributions differ.
To address these limitations, we propose Adaptive Large Margin Nearest Neighbor (AdaLMNN), an unsupervised domain-adaptation framework for EEG emotion recognition. AdaLMNN retains the discriminative pull–push principle while normalizing its components, adapting the margin to the initial projected geometry, and refreshing same-class neighborhoods during optimization. It further uses confidence-guided target pseudo-labels to perform class-balanced conditional distribution alignment, thereby reducing source–target mismatch without indiscriminately merging different emotion classes. The main contributions of this paper are as follows:
  • To improve EEG neighborhood discrimination while reducing cross-domain distribution mismatch, we propose AdaLMNN, an unsupervised domain-adaptation method that learns a shared Mahalanobis projection from labeled source samples and unlabeled target features without using target ground-truth labels during fitting.
  • We dynamically update source neighborhoods and target pseudo-labels so that adaptive large-margin discrimination and class-balanced conditional alignment evolve together, while loss normalization, alignment scheduling, and scale regularization ensure stable optimization.
  • AdaLMNN is evaluated on synthetic data and the SEED and SEED-IV datasets under within-session, leave-one-session-out, and leave-one-subject-out protocols. The results show its clearest benefits under within-session evaluation, competitive performance under session-level shifts, and limitations under the stronger cross-subject shift.

2. Methodology

Figure 1 provides an overview of the AdaLMNN framework. Given labeled source features and unlabeled target features, AdaLMNN initializes a shared projection and then optimizes two complementary objectives in the evolving projected space. The normalized adaptive large-margin term uses source labels to contract same-class neighborhoods and separate hard impostors, while periodically refreshing the neighborhoods as the metric changes. In parallel, the confidence-guided conditional alignment term assigns pseudo-labels to target samples using source-domain neighbors, retains only high-confidence assignments, and reduces class-wise source–target discrepancies. The two terms, together with scale regularization and a scheduled alignment weight, jointly update the projection; the updated geometry subsequently changes both the source neighborhoods and target pseudo-labels. The resulting projection maps the two domains into a discriminative Mahalanobis space with more compact emotion classes and reduced class-conditional mismatch. Target ground-truth labels are excluded from metric fitting and are used only for final evaluation.
Figure 1. Overview of the proposed AdaLMNN method. Blue and gray markers denote labeled source and unlabeled target samples, respectively; circles, squares, and triangles indicate emotion classes. Blue and black contours outline the source and target distributions, while orange elements show the coupled objectives and learned class boundaries. AdaLMNN combines adaptive large-margin discrimination with confidence-guided conditional alignment to learn a discriminative, domain-aligned Mahalanobis projection without target ground-truth labels.

2.1. Problem Formulation

Let S = { ( x i s , y i s ) } i = 1 n s denote a labeled source domain and T = { x u t } u = 1 n t an unlabeled target domain, with x i s , x u t ∈ R d and a class set C . Adaptive Large Margin Nearest Neighbor (AdaLMNN) learns a single linear projection L ∈ R q × d that is shared by the two domains. The projected representation is z = L x , and the corresponding squared Mahalanobis distance is
d L 2 ( x a , x b ) = ∥ L ( x a − x b ) ∥ 2 2 = ( x a − x b ) T M ( x a − x b ) , M = L T L ⪰ 0 .
Optimizing L directly guarantees that M is positive semi-definite without a separate projection step. The same transformation therefore performs feature reweighting, models cross-feature correlations, and can reduce the original feature dimension when q < d . Only source labels enter the supervised metric-learning term; target features affect the model exclusively through unsupervised distribution alignment.

2.2. Normalized Large-Margin Discriminative Loss

Following LMNN [22], each source sample i is assigned a set N i of same-class target neighbors in the current projected space. For computationally efficient margin enforcement, I i ( h ) contains only the h nearest different-class impostors. Defining P = { ( i , j ) : j ∈ N i } and Q = { ( i , j , k ) : j ∈ N i , k ∈ I i ( h ) } , the implementation uses pair- and triplet-normalized pull and push losses:
L pull ( L ) = 1 | P | ∑ ( i , j ) ∈ P d L 2 ( x i s , x j s ) ,
L push ( L ) = 1 | Q | ∑ ( i , j , k ) ∈ Q m + d L 2 ( x i s , x j s ) − d L 2 ( x i s , x k s ) + ,
L LMNN ( L ) = ( 1 − μ ) L pull ( L ) + μ L push ( L ) ,
where [ a ] + = max ( 0 , a ) and μ ∈ [ 0 , 1 ] balances intra-class compactness against inter-class separation. Normalization prevents the magnitude of either component from changing merely because the numbers of available neighbor pairs or evaluated impostor triplets differ across folds. The same-class neighbor sets are periodically recomputed under the current L, so the local supervision follows the evolving metric rather than remaining fixed in the original Euclidean space.
Instead of imposing an arbitrary unit margin, AdaLMNN optionally estimates m from the initial projected geometry. Let G = { d L 2 ( x i s , x k s ) − d L 2 ( x i s , x j s ) : ( i , j , k ) ∈ Q } at initialization. The margin is selected as
m = max m min , Q τ ( G ) ,
where Q τ is the τ -quantile and m min > 0 is a numerical lower bound. This choice activates a controlled fraction of informative triplets at the start of training and adapts the scale of the margin to each fold.

2.3. Confidence-Guided Conditional Domain Alignment Loss

Marginal source–target alignment can mix class modes when their proportions differ. AdaLMNN therefore performs class-conditional alignment by generating target pseudo-labels from source samples only. For each target point x u t , the k p nearest source samples are found under d L 2 ; majority voting gives y ^ u t , and the winning vote proportion defines the confidence a u :
y ^ u t = arg max c ∈ C ∑ i ∈ K u 1 [ y i s = c ] , a u = 1 k p max c ∈ C ∑ i ∈ K u 1 [ y i s = c ] .
Only target samples satisfying a u ≥ η participate in alignment. The pseudo-labels and confidence mask are refreshed periodically as L changes. Consequently, target ground-truth labels are never used during metric fitting, and uncertain target assignments cannot directly drive the domain-alignment gradient.
For a class c, let S c = { i : y i s = c } and T c = { u : y ^ u t = c , a u ≥ η } . Classes with fewer than two eligible samples in either domain are omitted, and the remaining class set is denoted by C a . With the feature map ϕ induced by kernel k, the class-balanced conditional maximum mean discrepancy is
L CMMD ( L ) = 1 | C a | ∑ c ∈ C a 1 | S c | ∑ i ∈ S c ϕ ( L x i s ) − 1 | T c | ∑ u ∈ T c ϕ ( L x u t ) H 2 .
For the linear kernel, each class term reduces to ∥ L ( x ¯ s c − x ¯ t c ) ∥ 2 2 , which matches projected class means. The RBF option uses k ( x a , x b ) = exp [ − γ d L 2 ( x a , x b ) ] and thus also responds to higher-order distributional differences. When γ is not specified, it is fixed at initialization by the squared-distance median rule, γ = [ 2 median a < b d L 2 ( x a , x b ) ] − 1 . If no class satisfies the minimum-sample condition, the conditional alignment loss and its gradient are set to zero. When conditional alignment is disabled, the same MMD estimator is applied once to all source and target samples to obtain marginal alignment.

2.4. Scale Regularization and Joint Adaptive Objective

An alignment loss alone admits degenerate solutions in which projected features collapse or acquire an arbitrary scale. Let Σ be the covariance of the joint source–target input used for fitting and I q the q-dimensional identity matrix. AdaLMNN controls the geometry of the projection through
R scale ( L ) = 1 q L Σ L T − I q F 2 .
This penalty discourages collapsed directions while preventing the optimization from satisfying the margin merely by unconstrained rescaling.
Because the numerical scales of LMNN and CMMD depend on the fold, their first effective loss values are frozen as references r LMNN = max ( L LMNN ( 0 ) , ϵ ) and r CMMD = L CMMD ( t + ) , where t + is the first iteration at which L CMMD > ϵ . The alignment term is introduced after an LMNN warm-up. With progress p t = t / max ( 1 , T − 1 ) and warm-up fraction w, the schedule is
s ( t ) = 0 , p t ≤ w , 2 1 + exp − 10 p t − w 1 − w − 1 , p t > w .
The objective implemented by AdaLMNN is therefore
min L J ( L ) = L LMNN ( L ) r LMNN + λ s ( t ) L CMMD ( L ) r CMMD + ρ R scale ( L ) ,
where λ ≥ 0 controls source–target alignment and ρ ≥ 0 controls scale regularization. Before a positive CMMD reference is observed, the normalized CMMD term and its gradient are defined as zero. The same frozen references scale both losses and their exact gradients, preserving consistency between the reported objective and the update direction.
The terms in this objective interact throughout optimization rather than operating as independent add-ons. The large-margin term establishes class-discriminative source neighborhoods, which are used to generate confidence-weighted target pseudo-labels for class-balanced conditional alignment. Because the neighborhoods and pseudo-labels are refreshed in the evolving projection, the alignment term subsequently changes the geometry that determines later neighbors and pseudo-labels. Frozen loss normalization, gradual activation of alignment, and scale regularization keep this feedback numerically balanced and prevent either objective from dominating the shared projection.

2.5. Initialization, Optimization, and Inference

The projection is initialized from the leading q eigenvectors of the covariance of the combined source and target features. With whitening enabled, each retained eigenvector is divided by the square root of its eigenvalue; the feasible output dimension is capped at min ( q , d , n s + n t − 1 ) . The RBF bandwidth and adaptive margin are fixed from this initial geometry. Same-class source neighborhoods are initialized at the same stage and refreshed during training, whereas hard impostors are mined under the current projection at every iteration.
AdaLMNN differentiates all three terms with respect to L and applies Adam updates with first- and second-moment coefficients 0.9 and 0.999 . The Frobenius norm of the joint gradient is clipped to a prescribed bound before each update. Same-class source neighborhoods and confidence-gated target pseudo-labels are refreshed at separate fixed intervals. Convergence is declared only after the minimum iteration count has been reached, the CMMD warm-up has been completed, and the relative objective change has remained below the tolerance for five consecutive iterations. The final metric is M = L T L , and any new feature vector is mapped with the fitted normalization parameters and the learned projection. This protocol performs unsupervised domain adaptation by incorporating unlabeled target features during optimization. This distinction is important: target features participate in PCA initialization, covariance regularization, pseudo-label construction, and CMMD alignment, but target ground-truth labels are reserved exclusively for final evaluation.
We evaluate the learned representation using three classifiers: a linear support vector machine (SVM), a k-nearest-neighbor (KNN) classifier, and a multilayer perceptron (MLP) [23,24]. Multiclass SVM is implemented with LIBSVM’s one-against-one strategy [25]; the linear kernel isolates the contribution of the learned representation rather than adding a second nonlinear mapping. KNN assigns the majority label among the k closest transformed source samples [26]. Because KNN depends directly on neighborhood geometry, it provides a direct test of whether AdaLMNN creates compact same-class regions and separates different-class samples. The MLP uses two hidden layers, ReLU activation, and Adam optimization. As a nonlinear parametric classifier, the MLP complements the linear SVM and neighborhood-based KNN evaluations.

3. Experiments and Results

3.1. Synthetic Dataset Description

Before evaluating the proposed method on real EEG data, we constructed controlled synthetic datasets to compare classification performance using standardized raw features, LMNN-transformed features, and AdaLMNN-transformed features. The synthetic experiment was designed as a controlled stress test of metric learning under progressively increasing class overlap and nuisance-feature noise; it was not intended to reproduce the complete physiological covariance structure or frequency-band specificity of real differential entropy features. Each synthetic dataset comprised three Gaussian-distributed classes, with 80 samples per class and 240 samples in total. Each sample combined discriminative dimensions with nuisance dimensions so that increasing class dispersion and nuisance noise progressively weakened the neighborhood structure available to Euclidean-distance KNN. The five difficulty settings are specified in the note below Table 1. For every difficulty level, the samples were divided using a stratified split, with 70% assigned to the labeled training set and 30% assigned to the unlabeled test set. Z-score standardization was fitted exclusively on the training set and then applied to both partitions.
Table 1. Classification accuracy (%) of different methods on synthetic datasets with different difficulty levels.

3.2. Real-EEG Dataset Description

The real-EEG evaluation used the EEG components of the SJTU Emotion EEG Dataset (SEED) [6] and the SEED-IV dataset [27]. The SEED dataset included 15 participants, each of whom viewed 15 film clips, each approximately four minutes long, that were selected to elicit positive, neutral, and negative affective states. EEG recordings are available for all 15 participants; synchronized eye-movement data are additionally provided for 12 of them, whereas the remaining three participants contribute EEG data only. Each viewing trial was preceded by a 5-s cue and followed by a 45-s self-assessment period and a 15-s rest interval. The SEED-IV dataset extends this framework to four emotion categories (happiness, sadness, fear, and neutrality) and provides paired EEG and eye-movement recordings from 15 participants over three experimental sessions, each comprising 24 trials.
EEG feature extraction aims to derive task-relevant and representative information from raw EEG signals. Empirical research has demonstrated that time-domain feature extraction yields superior performance for emotion recognition tasks. Among these methods, DE was selected as the primary feature representation because it effectively captures the statistical characteristics of EEG signals. DE is mathematically defined as:
h ( X ) = − ∫ − ∞ ∞ 1 2 π σ 2 e − ( x − μ ) 2 2 σ 2 log 1 2 π σ 2 e − ( x − μ ) 2 2 σ 2 d x = 1 2 log ( 2 π e σ 2 ) ,
where the time series X follows a Gaussian distribution characterized by a mean μ and a variance σ 2 , denoted by N ( μ , σ 2 ) .

3.3. Experimental Setting

The real-EEG data experiments used the pre-extracted features provided with SEED and SEED-IV. Each sample was represented by five frequency bands from 62 EEG channels, resulting in a 310-dimensional feature vector. Classification accuracy was used as the primary evaluation metric. To examine progressively more demanding forms of distribution shift, we implemented three complementary evaluation protocols: within-session, leave-one-session-out, and leave-one-subject-out. Under the within-session protocol, each subject–session pair was evaluated independently using a chronological trial split. For SEED, the first 9 of the 15 trials formed the source set and the remaining 6 trials formed the target set; for SEED-IV, the corresponding split was 16 source trials and 8 target trials out of 24. Under the leave-one-session-out protocol, one complete session from a subject was held out as the target domain, while the other two sessions from that subject constituted the labeled source domain. Each of the three sessions was held out once for every subject, producing 45 evaluation folds per dataset. Under the leave-one-subject-out protocol, all three sessions of one subject were treated as the target domain and the sessions of the other 14 subjects formed the source domain. Repeating this procedure for every subject produced 15 cross-subject folds.

3.4. Classification Performance

3.4.1. Synthetic Data Validation

Table 1 compares Raw, LMNN, and AdaLMNN under five progressively more difficult synthetic settings. Raw accuracy decreases from 77.78% at Level 1 to 40.28% at Level 5, confirming that increasing class dispersion and nuisance-feature noise progressively degrade the Euclidean neighborhood structure. LMNN improves accuracy at every level by 18.05–26.39% and raises the mean accuracy from 56.11% to 78.61%, an average gain of 22.50%. These results verify that supervised large-margin metric learning remains effective across a broad range of class-overlap and noise conditions. AdaLMNN achieves the highest mean accuracy of 79.72%, exceeding Raw and LMNN by 23.61% and 1.11%, respectively. Compared with LMNN, AdaLMNN performs better at Levels 1, 2, and 5, reaches the same accuracy at Level 3, and is 2.77% lower at Level 4. This pattern indicates that adaptive margin estimation and confidence-guided conditional alignment provide a complementary benefit beyond conventional LMNN, although severe class overlap may reduce the reliability of target pseudo-labels.
Figure 2 provides a qualitative comparison of the three representations at Level 2. In the Raw space, the three classes overlap substantially and the resulting decision regions are fragmented. Both metric-learning transformations produce more compact class-specific neighborhoods and clearer boundaries. AdaLMNN further places the training and test samples of each class in closely corresponding regions, consistent with the quantitative increase from 61.11% for Raw to 87.50% for LMNN and 90.28% for AdaLMNN.
Figure 2. t-SNE visualization of synthetic samples under the Level 2 setting. The three panels compare the Raw, LMNN, and AdaLMNN feature spaces, where transparent points denote training samples and solid points denote test samples.

3.4.2. Real-EEG Data Evaluation

Table 2 summarizes the classification accuracy of SVM, KNN, and MLP using the original features and the proposed AdaLMNN transformation on both the SEED and SEED-IV datasets. Under within-session evaluation, AdaLMNN improved all three classifiers on both datasets. The gains over the original features were 4.56 % , 13.72%, and 6.35 % for SVM, KNN, and MLP on SEED, respectively. The corresponding gains on SEED-IV were 2.04%, 6.93%, and 5.35 % . Under leave-one-session-out evaluation, AdaLMNN improved SVM and KNN by 7.33 % and 9.27 % on SEED, and by 7.04 % and 8.06% on SEED-IV. In contrast, MLP accuracy decreased by 0.10 % on SEED and by 0.67 % on SEED-IV. Under leave-one-subject-out evaluation on SEED, AdaLMNN improved SVM and KNN by 10.15 % and 6.11 % , respectively, whereas MLP accuracy increased by 1.86 % . On SEED-IV, AdaLMNN increased SVM accuracy by 0.47% but reduced KNN and MLP accuracy by 1.50% and 4.05 % , respectively. Overall, the gains were most consistent under within-session evaluation and on SEED, whereas performance became dataset- and classifier-dependent under the stronger subject-level shift.
Table 2. Classification accuracy (%) of the baseline and AdaLMNN-enhanced classifiers under three evaluation protocols on the SEED and SEED-IV datasets. Results are reported as the mean ± standard deviation across evaluation folds.
To extend the comparison beyond metric-learning baselines, Figure 3 compares the original representation with PCA, TCA, CORAL, and AdaLMNN, each followed by a linear SVM, on the SEED and SEED-IV datasets. All methods use the same within-session, leave-one-session-out, and leave-one-subject-out protocols. PCA and TCA reduce the 310-dimensional DE features to 50 dimensions, whereas CORAL retains all 310 dimensions. Across the available results, AdaLMNN achieved the highest within-session accuracy on both datasets, reaching 76.45% on SEED and 43.83% on SEED-IV. These values exceeded the raw representation by 4.56 % and 2.04%, respectively. Under leave-one-session-out evaluation, AdaLMNN achieved the highest accuracy on SEED, whereas PCA achieved the highest accuracy on SEED-IV. On SEED, AdaLMNN reached 72.94 % , compared with 72.30% for PCA and 71.70% for TCA. On SEED-IV, it reached 52.78%, compared with 54.23% for PCA and 52.54% for TCA. Under leave-one-subject-out evaluation, TCA achieved the highest accuracy on SEED and SEED-IV at 67.17% and 49.35%, respectively. AdaLMNN improved over the raw representation from 52.63% to 62.78 % on SEED and from 37.71 % to 38.18 % on SEED-IV. On SEED, AdaLMNN showed broadly comparable performance to PCA and TCA and slightly outperformed CORAL. On SEED-IV, however, it performed slightly below PCA, TCA, and CORAL under the stronger subject-level shift. Statistical significance was evaluated from participant-level accuracy scores across all 15 participants. For within-session and leave-one-session-out, the three session scores were averaged per participant; leave-one-subject-out used one score per participant. Friedman tests identified overall method differences in all six panels ( p < 0.002 ). After within-panel Holm correction, 18 of the 24 paired Wilcoxon comparisons remained significant. Overall, AdaLMNN performed best under within-session evaluation and remained competitive under session-level shift, whereas PCA and TCA were more robust to subject-level shift.
Figure 3. Classification accuracy for the raw, PCA, TCA, CORAL, and AdaLMNN-based representations on (a) the SEED dataset and (b) the SEED-IV dataset under three evaluation protocols. Bars show mean accuracy and error bars show the standard deviation across available folds.
Figure 4 compares the standardized original and AdaLMNN-transformed SEED DE feature spaces for subject 1 under three evaluation protocols. The original embeddings showed fragmented and overlapping emotion structures, with pronounced neutral–negative mixing and visible source–target displacement. Under the within-session protocol, AdaLMNN reorganized the samples into three compact, class-dominant regions and placed the source and target samples of each emotion in largely corresponding neighborhoods. Under leave-one-session-out evaluation, the transformed space likewise exhibited three distinct emotion regions, although the source and target samples retained different within-class densities, indicating that session-related variation was reduced but not completely eliminated. In contrast, the leave-one-subject-out embedding retained substantial overlap among the three emotion classes and showed only a coarse class-dependent spatial ordering after transformation, suggesting that participant-specific variation was not fully removed. Because t-SNE is a nonlinear two-dimensional embedding, these plots are interpreted as qualitative evidence of neighborhood organization rather than as a direct measure of separability in the full feature space. Overall, AdaLMNN produced the clearest geometric reorganization under trial- and session-level shifts, whereas generalization to an unseen participant remained the most challenging protocol.
Figure 4. t-SNE comparison of the standardized original and AdaLMNN-transformed SEED feature spaces for subject 1 under (a) within-session, (b) leave-one-session-out, and (c) leave-one-subject-out protocols. Light and dark blue distinguish source and target samples, while circles, triangles, and squares denote positive, neutral, and negative emotions, respectively.

4. Discussion

4.1. Parameter Sensitivity Analysis

Using the SEED DE moving-average features and the within-session SVM pipeline, we evaluated the sensitivity to d, λ , and μ . The grid contained d ∈ { 20 , 50 , 100 , 200 , 310 } and λ ∈ { 0.01 , 0.1 , 0.5 , 1 , 10 } . We tested μ ∈ { 0.1 , 0.3 , 0.5 , 0.7 , 0.9 } , yielding 125 configurations and 5625 fits across 45 subject–session folds. Figure 5 identifies the projection dimension as the dominant factor. The best configuration, d = 50 , λ = 0.1 , and μ = 0.5 , achieved a mean inner-validation accuracy of 75.76 % , with a standard deviation of 15.05 % across the 45 subject–session folds. Eleven configurations were within 1 % of this maximum: ten used d = 50 , mainly with moderate λ and μ , and one used d = 20 . The best accuracies at d = 100 , 200, and 310 decreased to 70.79%, 69.33%, and 67.79%, respectively. Relative to d = 50 , the accuracy of the original 310-dimensional setting was 7.97 % lower. Moderate alignment and pull–push weighting produced a broad high-accuracy region at d = 50 . However, the large fold-to-fold variation indicates substantial inter-subject and inter-session heterogeneity, so the dashed region denotes practical near-best settings rather than statistical equivalence. Accordingly, this result is interpreted only as an inner-validation score for hyperparameter selection. It does not demonstrate uniformly stable performance across all participants and sessions and is not an outer-test performance estimate.
Figure 5. AdaLMNN hyperparameter search on the SEED dataset under the within-session protocol. Red dashed cells are within 0.010 absolute accuracy of the best configuration.

4.2. Ablation Study

We evaluated four controlled variants to isolate two core modules: adaptive margin estimation coupled with neighborhood refresh (AM+NR), and conditional domain alignment (CA), as summarized in Table 3. AdaLMNN w/o AM+NR+CA serves as the conventional LMNN reference, using a fixed margin of 1.0 and static same-class source neighborhoods without pseudo-labeling or conditional MMD. AdaLMNN w/o CA enables only AM+NR, whereas AdaLMNN w/o AM+NR retains only CA. Full AdaLMNN combines both modules and optimizes the complete objective in Equation (10). Target ground-truth labels are excluded from training and used only for final evaluation.
Table 3. Ablation study results for AdaLMNN on the SEED and SEED-IV datasets under the within-session protocol.
The ablation results quantify the individual and combined effects of the two modules. On SEED, AM+NR decreased accuracy by 0.68 % , whereas CA increased it by 0.24 % ; on SEED-IV, AM+NR and CA increased accuracy by 2.10 % and 0.84 % , respectively. Full AdaLMNN achieved the best results, with overall gains of 5.04 % and 6.91 % , and outperformed both single-module variants on the two datasets. These findings support the complementary contributions of AM+NR and CA, although statistically super-additive synergy is not claimed without a formal interaction test.

4.3. Model Convergence Analysis

Figure 6 shows stable convergence for a representative SEED within-session fold for subject 1 in session 1. The raw LMNN loss decreases sharply during the first 70 iterations and then declines gradually, whereas the raw CMMD loss initially increases and peaks near iteration 60. This transient rise reflects the scheduled loss weighting rather than optimization divergence. During the initial 20% LMNN warm-up, the effective CMMD weight is zero, allowing the model to first learn discriminative source-domain neighborhoods. This design improves the class structure used to generate reliable confidence-guided target pseudo-labels before domain alignment becomes influential. After warm-up, the CMMD weight increases smoothly from zero, driving the CMMD loss downward; after approximately 90 iterations, both losses decrease steadily toward stable low-loss levels. The resulting trajectories demonstrate the numerical stability and practical convergence of the optimization.
Figure 6. Representative AdaLMNN optimization trajectory on SEED for subject 1 in session 1 under the within-session protocol. The blue curve shows the raw LMNN loss on the left vertical axis, and the red curve shows the raw CMMD loss on the right vertical axis.

5. Conclusions

This paper addressed the inability of Euclidean distance and conventional source-only LMNN to jointly model discriminative EEG feature geometry and trial-, session-, and subject-related distribution shifts. We proposed AdaLMNN, an unsupervised domain-adaptation method that integrates normalized large-margin discrimination, confidence-guided pseudo-labels, and class-balanced conditional alignment within a shared Mahalanobis projection. Experiments on synthetic datasets and the SEED and SEED-IV datasets showed that AdaLMNN provides an effective and interpretable enhancement for EEG differential-entropy representations, particularly under trial- and session-level distribution shifts. Future work will develop nonlinear extensions and strengthen pseudo-label reliability across unseen subjects.

Author Contributions

Conceptualization, X.-C.Z.; methodology, X.-C.Z., Q.W.; software, X.-C.Z., X.W.; validation, X.W.; formal analysis, D.Y., Q.W.; investigation, X.-C.Z., X.W.; resources, S.Z.; writing—original draft preparation, X.-C.Z.; writing—review and editing, D.Y., X.W., Q.W.; visualization, X.W.; supervision, Q.W.; Project administration, S.Z.; funding acquisition, Q.W., S.Z. All authors have read and agreed to the published version of the manuscript.

Funding

This research received no external funding.

Data Availability Statement

Our study uses publicly available EEG data from the SEED dataset. No new human or animal experiments were conducted in this study, and therefore no additional Ethics Committee or Institutional Review Board approval was required for our research. The dataset used in this study is publicly available at: https://bcmi.sjtu.edu.cn/home/seed/, accessed on 1 May 2026.

Conflicts of Interest

The authors declare no conflicts of interest.

References

  1. Chi, Y.M.; Wang, Y.T.; Wang, Y.; Maier, C.; Jung, T.P.; Cauwenberghs, G. Dry and Noncontact EEG Sensors for Mobile Brain–Computer Interfaces. IEEE Trans. Neural Syst. Rehabil. Eng. 2012, 20, 228–235. [Google Scholar] [CrossRef] [Scilit] [PubMed]
  2. Huang, Y.J.; Wu, C.Y.; Wong, A.M.K.; Lin, B.S. Novel Active Comb-Shaped Dry Electrode for EEG Measurement in Hairy Site. IEEE Trans. Biomed. Eng. 2015, 62, 256–263. [Google Scholar] [CrossRef] [Scilit] [PubMed]
  3. Liu, Y.J.; Yu, M.; Zhao, G.; Song, J.; Ge, Y.; Shi, Y. Real-Time Movie-Induced Discrete Emotion Recognition from EEG Signals. IEEE Trans. Affect. Comput. 2018, 9, 550–562. [Google Scholar] [CrossRef] [Scilit]
  4. Riaz, W.; Ji, J.; Ullah, A. TriViT-Lite: A Compact Vision Transformer–MobileNet Model with Texture-Aware Attention for Real-Time Facial Emotion Recognition in Healthcare. Electronics 2025, 14, 3256. [Google Scholar] [CrossRef] [Scilit]
  5. Cai, J.; Xiao, R.; Cui, W.; Zhang, S.; Liu, G. Application of Electroencephalography-Based Machine Learning in Emotion Recognition: A Review. Front. Syst. Neurosci. 2021, 15, 729707. [Google Scholar] [CrossRef] [Scilit] [PubMed]
  6. Zheng, W.L.; Lu, B.L. Investigating Critical Frequency Bands and Channels for EEG-Based Emotion Recognition with Deep Neural Networks. IEEE Trans. Auton. Ment. Dev. 2015, 7, 162–175. [Google Scholar] [CrossRef] [Scilit]
  7. Duan, R.N.; Zhu, J.Y.; Lu, B.L. Differential Entropy Feature for EEG-Based Emotion Classification. In Proceedings of the 2013 6th International IEEE/EMBS Conference on Neural Engineering (NER); IEEE: New York, NY, USA, 2013; pp. 81–84. [Google Scholar] [CrossRef] [Scilit]
  8. Topic, A.; Russo, M. Emotion Recognition Based on EEG Feature Maps through Deep Learning Network. Eng. Sci. Technol. Int. J. 2021, 24, 1442–1454. [Google Scholar] [CrossRef] [Scilit]
  9. Zhong, M.Y.; Yang, Q.Y.; Liu, Y.; Zhen, B.Y.; Zhao, F.D.; Xie, B.B. EEG Emotion Recognition Based on TQWT-Features and Hybrid Convolutional Recurrent Neural Network. Biomed. Signal Process. Control 2023, 79, 104211. [Google Scholar] [CrossRef] [Scilit]
  10. Zhong, P.; Wang, D.; Miao, C. EEG-Based Emotion Recognition Using Regularized Graph Neural Networks. IEEE Trans. Affect. Comput. 2022, 13, 1290–1301. [Google Scholar] [CrossRef] [Scilit]
  11. Wang, Z.; Wang, Y.; Hu, C.; Yin, Z.; Song, Y. Transformers for EEG-Based Emotion Recognition: A Hierarchical Spatial Information Learning Model. IEEE Sens. J. 2022, 22, 4359–4368. [Google Scholar] [CrossRef] [Scilit]
  12. Li, C.; Zhang, Z.; Song, R.; Cheng, J.; Liu, Y.; Chen, X. EEG-Based Emotion Recognition via Neural Architecture Search. IEEE Trans. Affect. Comput. 2023, 14, 957–968. [Google Scholar] [CrossRef] [Scilit]
  13. Li, Z.; Zhu, E.; Jin, M.; Fan, C.; He, H.; Cai, T.; Li, J. Dynamic Domain Adaptation for Class-Aware Cross-Subject and Cross-Session EEG Emotion Recognition. IEEE J. Biomed. Health Inform. 2022, 26, 5964–5973. [Google Scholar] [CrossRef] [Scilit] [PubMed]
  14. Zhong, X.C.; Wang, Q.; Li, R.; Liu, Y.; Duan, S.; Yang, R.; Liu, D.; Sun, J. Unsupervised Domain Adaptation with Pseudo-Label Propagation for Cross-Domain EEG Emotion Recognition. IEEE Trans. Instrum. Meas. 2025, 74, 2522211. [Google Scholar] [CrossRef] [Scilit]
  15. Wu, X.; Ju, X.; Dai, S.; Li, X.; Li, M. Multi-Source Domain Adaptation for EEG Emotion Recognition Based on Inter-Domain Sample Hybridization. Front. Hum. Neurosci. 2024, 18, 1464431. [Google Scholar] [CrossRef] [Scilit] [PubMed]
  16. Wang, J.; Ning, X.; Xu, W.; Li, Y.; Jia, Z.; Lin, Y. Multi-Source Selective Graph Domain Adaptation Network for Cross-Subject EEG Emotion Recognition. Neural Netw. 2024, 180, 106742. [Google Scholar] [CrossRef] [Scilit] [PubMed]
  17. Ju, X.; Su, J.; Dai, S.; Wu, X.; Li, M.; Hu, D. Domain Adversarial Neural Network with Reliable Pseudo-Labels Iteration for Cross-Subject EEG Emotion Recognition. Knowl.-Based Syst. 2025, 316, 113368. [Google Scholar] [CrossRef] [Scilit]
  18. Tang, J.; Li, Y.; Su, C.W.; Fan, X.; Zheng, Y. UDA-DDA: Unsupervised Domain Adaptation with Dynamic Distribution Alignment Network for Emotion Recognition Using EEG Signals. Neurocomputing 2025, 658, 131715. [Google Scholar] [CrossRef] [Scilit]
  19. Zhou, B.; Xiang, M.; Ning, Q. ProDG: A Proxy-Domain-Guiding Strategy for Multi-Source-Free Domain Adaptation in EEG Emotion Recognition. Knowl.-Based Syst. 2025, 329, 114318. [Google Scholar] [CrossRef] [Scilit]
  20. Luo, Z.; She, Q.; Jin, T.; Li, Y.; Xi, X. Adaptive Graph Convolution Domain Adaptation Network for Cross-Subject EEG Emotion Recognition. Med. Biol. Eng. Comput. 2026, 1–23. [Google Scholar] [CrossRef] [Scilit] [PubMed]
  21. Huang, L.; Li, M.; Gao, G.; Qian, M. Dual Pseudo-Labeling Based Adversarial Domain Adaptation for EEG-Based Emotion Recognition. Biomed. Phys. Eng. Express 2026, 12, 015057. [Google Scholar] [CrossRef] [Scilit] [PubMed]
  22. Weinberger, K.Q.; Saul, L.K. Distance Metric Learning for Large Margin Nearest Neighbor Classification. J. Mach. Learn. Res. 2009, 10, 207–244. [Google Scholar]
  23. Noble, W.S. What Is a Support Vector Machine? Nat. Biotechnol. 2006, 24, 1565–1567. [Google Scholar] [CrossRef] [Scilit] [PubMed]
  24. Peterson, L.E. K-Nearest Neighbor. Scholarpedia 2009, 4, 1883. [Google Scholar] [CrossRef] [Scilit]
  25. Chang, C.C.; Lin, C.J. LIBSVM: A Library for Support Vector Machines. ACM Trans. Intell. Syst. Technol. 2011, 2, 27. [Google Scholar] [CrossRef] [Scilit]
  26. Zhou, Y.; Li, Y.; Xia, S. An Improved KNN Text Classification Algorithm Based on Clustering. J. Comput. 2009, 4, 230–237. [Google Scholar] [CrossRef] [Scilit]
  27. Zheng, W.L.; Liu, W.; Lu, Y.; Lu, B.L.; Cichocki, A. EmotionMeter: A Multimodal Framework for Recognizing Human Emotions. IEEE Trans. Cybern. 2019, 49, 1110–1122. [Google Scholar] [CrossRef] [Scilit] [PubMed]
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

Article Metrics

Citations

Article Access Statistics

Multiple requests from the same IP address are counted as one view.