---
title: 'SSI-GAN: Semi-supervised Spike Classification'
url: https://www.emergentmind.com/topics/semi-supervised-swin-inspired-gan-ssi-gan
type: topic
---

# SSI-GAN: Semi-supervised Spike Classification

The Semi-supervised Swin-Inspired GAN (SSI-GAN) is a generative adversarial network architecture designed to classify neuronal spike trains in the context of arboviral infection detection. Addressing the critical challenge of limited labeled data in large-scale electrophysiology, SSI-GAN integrates a transformer-based generator and a Swin-inspired shifted-window discriminator for robust, semi-supervised classification. It markedly reduces manual labeling requirements while achieving high performance in distinguishing Zika, dengue, and control patterns in Aedes aegypti neuronal recordings [2601.00189].

## 1. Input Representation and Preprocessing Pipeline

SSI-GAN operates directly on neuronal spike data acquired via 60-electrode microelectrode arrays (MEA) sampled at 30 kHz. The raw signals undergo minimal preprocessing steps: a high-pass Butterworth filter (700 Hz cutoff) removes low-frequency local field potential (LFP) noise, while thresholding at ±10 μV zeroes out values in (−10,10) μV, effectively denoising the signal and focusing on salient spike events. The continuous recordings are segmented into non-overlapping windows of T = 100 samples, yielding inputs $x \in \mathbb{R}^{100 \times 60}$, where C=60 denotes electrodes. In the semi-supervised regimen, only 3% of windows are labeled, with the remainder remaining unlabeled, reflecting realistic annotation constraints.

## 2. Transformer-based Generator Architecture

The SSI-GAN generator $G$ synthesizes plausible spike windows from Gaussian noise $z \sim \mathcal{N}(0,I_{128})$ with dimensionality $d_z=128$. The architecture comprises two stacked Transformer blocks, each with embedding dimension $d_{\mathrm{model}}=128$. Within each block:

- Multi-head self-attention is utilized with $h=4$ heads ($d_k=d_v=d_{\mathrm{model}}/h=32$).
- Sinusoidal positional encoding is applied such that for position pos and channel i: 
  $$
  \text{PE}_{\text{pos},2i} = \sin\left(\frac{\text{pos}}{10000^{2i/d_\text{model}}}\right),\;
  \text{PE}_{\text{pos},2i+1} = \cos\left(\frac{\text{pos}}{10000^{2i/d_\text{model}}}\right)
  $$
- Feed-forward network (FFN) in each block has hidden dimension $d_{\mathrm{ff}}=64$ and employs GeLU or ReLU activations.
- Layer Normalization, dropout (rate $p_{drop}=0.29$, optimized via Bayesian Optuna), and residual pathways enhance stability and regularization.

This configuration enables $G$ to generate high-frequency, realistic spike patterns consistent with observed neuronal signal properties.

## 3. Swin-Inspired Shifted-Window Discriminator

The discriminator applies a windowing strategy inspired by Swin transformer mechanisms. For input $x \in \mathbb{R}^{100 \times 60}$, the time axis is partitioned into non-overlapping windows of length M=10. Even-numbered layers use these native partitions, while odd-numbered layers implement a “shifted-window” approach by rolling $x$ by $M/2$ before repartitioning. This alternating schema fosters both localized intra-window attention and cross-boundary contextual integration by facilitating cross-window communications without full multi-head attention.

Within each window, the discriminator layers proceed as follows:

- Window-based Multi-head Self-Attention (W-MSA): $y = \mathrm{W\text{-}MSA}(\mathrm{LayerNorm}(x)) + x$
- Feed-forward network plus residual: $z = \mathrm{FFN}(\mathrm{LayerNorm}(y)) + y$
- No hierarchical patch merging takes place; resolution is fully retained.
- Cross-window attention in shifted layers enables elements from overlapping windows to attend over shared indices, embedding broader dependencies.

Global average pooling (GAP) aggregates feature embeddings into $g \in \mathbb{R}^{d_{\mathrm{model}}}$, which feeds two output heads:

- Classification head: 3-way softmax distinguishes Zika, dengue, and control categories, $\hat{y} = \mathrm{softmax}(W_{\text{cls}}g + b_{\text{cls}}) \in \Delta^2$.
- Adversarial head: Sigmoid outputs real/fake discrimination probability, $s = \sigma(w_{\text{adv}}^Tg + b_{\text{adv}}) \in (0,1)$.

## 4. Semi-supervised Learning Protocol

SSI-GAN’s workflow leverages both labeled and unlabeled spike windows for model optimization:

- Data split: 80% of windows for training, 20% for test; within training, 3% are labeled and the rest unlabeled, with 1% held back as validation for early stopping.
- Loss functions:
  - Adversarial loss for D and G:
    $$
    L_{\text{GAN}}^D = -\mathbb{E}_{x\sim p_{\text{data}}}[\log s(x)] - \mathbb{E}_{z\sim p_z}[\log(1 - s(G(z)))]
    $$
    $$
    L_{\text{GAN}}^G = -\mathbb{E}_{z\sim p_z}[\log s(G(z))]
    $$
  - Classification loss on labeled data:
    $$
    L_{\text{cls}} = -\mathbb{E}_{(x,y)\sim \text{labeled}}\sum_{c=0}^{2} \mathbf{1}_{y=c}\,\log \hat{y}_c(x)
    $$
  - Composite objectives:
    $$
    L_D = L_{\text{GAN}}^D + \lambda_{\text{cls}} L_{\text{cls}},\;\; \lambda_{\text{cls}} = 1.0
    $$
    $$
    L_G = L_{\text{GAN}}^G \;\text{(optionally with small feature-matching term)}
    $$

This bifurcated loss structure enables SSI-GAN to extract discriminative spike features from the scarce labels while adversarially regularizing via synthetic spike generation.

## 5. Hyperparameter Optimization and Validation Strategy

SSI-GAN applies Bayesian Optuna for rigorous hyperparameter search over the generator and discriminator settings. Parameters explored include $d_z \in \{64,100,128\}$, number of attention heads $\{2,4,8\}$, head size $\{64,128,256\}$, $d_{\mathrm{ff}} \in \{32,64,128\}$, number of blocks (1–4), dropout (0.1–0.5), learning rate ($1\times10^{-5}$–$1\times10^{-3}$), and batch size $\{64,128\}$ over 20 trials. The objective maximizes classification accuracy on the 1% validation split. Optimal hyperparameters identified: $d_z=128$, heads=4, head size=128, $d_{\mathrm{ff}}=64$, blocks=2, dropout=0.29, learning rate=9e-4, batch size=128.

Monte Carlo cross-validation is performed on five randomly partitioned data splits per run, reporting mean and standard deviation of accuracy, precision, recall, and F1-score, mitigating sensitivity to sample selection and ensuring statistical robustness.

## 6. Empirical Performance and Comparative Analysis

SSI-GAN’s evaluation on 15,728,580 spike windows across five post-infection days (0, 1, 2, 3, and 7 dpi) and three classes (control, DENV, ZIKV) demonstrates near-perfect classification with minimal supervision. Performance metrics at 3% labeled data are:

| Time-point (dpi) | SSI-GAN Accuracy (%) | Best Baseline CNN-GRU (%) |
|------------------|---------------------|---------------------------|
| 0                | 99.45               | 91.6                      |
| 1                | 99.61               | 91.1                      |
| 2                | 97.09               | 83.2                      |
| 3                | 99.82               | —                         |
| 7                | 99.93               | —                         |

SSI-GAN consistently outperforms the strongest supervised baseline (CNN-GRU) by more than 8% at all reported time-points, while using only 1–3% labels—a 97–99% reduction in annotation effort. Accuracy standard deviation over five Monte Carlo runs remains below 0.5% at all days post-infection; paired t-tests indicate statistical significance ($p<0.01$) versus baselines.

## 7. Impact and Implications in Neurovirology Spike Classification

SSI-GAN advances semi-supervised learning capabilities for large-scale neurovirology, offering state-of-the-art accuracy in classifying mosquito neuronal infection status with severely limited labels. By dispensing with exhaustive spike annotation and leveraging a shifted-window, transformer-based architecture, it makes mass deployment in field studies feasible, supporting viral neurotropism surveillance. The architecture’s novel combination of windowed and shifted-window attention mechanisms in the discriminator is empirically superior for high-frequency, sparse spike classification and may suggest broader applicability in electrophysiological pattern recognition. These findings set new data-efficient performance benchmarks in spike-based infection classification and demonstrate robust generalization across temporal stages of infection [2601.00189].

Source: https://www.emergentmind.com/topics/semi-supervised-swin-inspired-gan-ssi-gan