Abstract
Traditional nearest-neighbor methods rely heavily on feature scaling and predefined distance metrics like Euclidean distance. We present the "Self-Encoder" (SE), a self-supervised neural network that learns data representations by solving an extreme identification task: distinguishing every individual sample in a dataset. This approach creates a latent geometry invariant to feature scaling and highly effective for tabular data. Our results show that the SE consistently outperforms standard $k$-NN and SVMs across various datasets without requiring manual feature normalization.
Introduction
In machine learning, particularly with tabular data, feature encoding is critical. Standard methods like $k$-Nearest Neighbors ($k$-NN) are sensitive to feature scaling; a feature with a larger numerical range can disproportionately influence distance calculations. While auto-encoders address representation learning through reconstruction, they may not capture the discriminative structures necessary for classification. The Self-Encoder addresses this by shifting the objective from reconstruction to identification, forcing the model to learn the unique characteristics of every data point.
Methods
The Self-Encoder (SE) is implemented as a Multi-Layer Perceptron (MLP) trained on a unique self-supervised task. Given a dataset of $n$ samples, the model treats each sample $x_i$ as its own unique class.
Architecture and Loss
The model maps an input $x \in \mathbb{R}^d$ through $L$ hidden layers to an output layer of dimension $n$. The final activation is typically a coordinate-wise sigmoid or SoftMax. The objective is to minimize Binary Cross Entropy (BCE), pushing the $i$-th output to 1 for input $x_i$ and all other outputs $j \neq i$ to 0.
Learned Geometry
The SE learns to place data in an embedding space where points are linearly separable. In this geometry, "closeness" is defined by the model's difficulty in distinguishing two samples. To identify neighbors for a new point, one simply observes the predicted probabilities; the training samples with the highest probabilities are considered the nearest neighbors.
Key Insights
A core advantage of the Self-Encoder is its affine invariance. The authors prove that the SE is invariant to any invertible affine transformation, such as scaling or rotation. If a feature is scaled by a factor, the network's first-layer weights can compensate proportionally, eliminating the need for manual preprocessing like min-max scaling. Furthermore, the model is robust to redundant features, as the identification task naturally prioritizes discriminative information.
Results
The Self-Encoder was evaluated on ten classic tabular datasets from the UCI repository, including medical, chemical, and financial data. Key findings include:
- Superior Accuracy: The SE consistently outperformed $k$-NN, SVMs, and standard MLPs. For instance, on the German Credit dataset with categorical features, SE achieved 0.768 accuracy, surpassing $k$-NN (0.716) and SVM (0.736).
- Robustness to Unscaled Data: Even when competing against $k$-NN models using normalized data, the SE—operating on raw, unscaled data—maintained superior performance.
- Efficiency via Sampling: To address the $O(n^2)$ complexity of a large output layer, the authors demonstrated that training on random subsets (e.g., 100 points) provides comparable performance, making the approach more feasible for larger datasets.
Limitations and Future Work
While effective, the Self-Encoder faces challenges in scalability due to the output layer size. Training a neural network is also more computationally intensive than the "zero-training" requirement of standard $k$-NN. Future research may explore using this identification task for large-scale self-supervised pre-training on tabular data, potentially mirroring the success of masked language models in natural language processing.
Summary updated