Unifying Sample, Feature, and Temporal Attention with KNN, SVM, and Sparse Coding

Authors

  • Mohamed Waleed Fakhr School of Computing, Coventry University TKH Branch, New Administrative Capital, Cairo, Egypt

DOI:

https://doi.org/10.37934/sej.17.1.116132

Keywords:

Attention mechanisms, Sparsemax, time series classification, support vector machines, Sparse coding

Abstract

This paper presents a unified framework demonstrating that k-Nearest Neighbors (KNN), Sparse Coding, Support Vector Machines (SVM), and attention mechanisms all compute the same weighted voting equation, differing only in how the weights are calculated. A Triple-Attention architecture is introduced, combining temporal, feature, and sample attention with both softmax and sparsemax normalization for multivariate time series classification. Two output modes are proposed: Vote mode, which performs direct label voting, and Head mode, which uses a learned projection. Experiments on seven benchmark datasets spanning six domains show that attention is competitive with classical and neural baselines on larger datasets and that KNN, SVM, and Sparse Coding are special cases of sample attention under increasingly restrictive constraints. Sparsemax attention selects only 1.8 to 4.5 active samples per query, while attention degrades much more gracefully than SVM under severe input noise.

Author Biography

Mohamed Waleed Fakhr, School of Computing, Coventry University TKH Branch, New Administrative Capital, Cairo, Egypt

waleed.fakhr@tkh.edu.eg

Downloads

Published

2026-11-23

Issue

Section

Articles