arXiv:2610.17312cs.LGOct 2026

Manuscript Offprint

arXiv:2610.17312

A Geometrical Approach to Constructing Neural Networks for Perfect Training-set Classification

Akos Hajnal

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

ABSTRACT

This paper proposes a method for constructing a neural network that achieves perfect classification of all samples in a given training set, without taking regularization into account. The network is constructed on-demand, with its layer sizes and neuron parameters determined through a geometrical analysis of the input data, in which separating hyperplanes are created and mapped to neurons with step activation functions. The proposed architecture consists of two hidden layers with distinct roles: inter-class separation and transformation of the data into a linearly separable representation. Inter-class separation requires every bi-chromatic pair of samples belonging to different classes to be separated by at least one hyperplane. We show that when this separation is achieved through a hierarchical partitioning of the data, the leaf nodes of the oblique decision tree, obtained as a byproduct, directly define the neurons of the linear separability layer, whose size is only one neuron greater than that of the inter-class separation layer. Experiments on the MNIST dataset demonstrate that the proposed method achieves perfect training-set classification, and compact models. The direct correspondence between the decision tree and network neurons enhances interpretability and explainability, while the construction procedure offers opportunities for parallel implementation and improved scalability.

Keywords Classification · Neural network · Oblique decision tree

1 Introduction

This paper concerns with creating dense, feedforward, multi-layer neural networks, with the objective to achieve perfect classification of the training set. Regularization is out of the scope; no attempt is made to discover generalizable regularities or latent correlations in the data, to achieve high accuracy on the test set.

Rather than training the parameters of a predefined architecture, the proposed approach creates the layers and neurons on-demand based on a geometrical interpretation of the data (points) and of neurons (hyperplanes). The use of the step function as activation function distills the operation of neurons to linear separation, and assigns distinct roles to the individual layers; moreover, the proposed method enables highly parallelizable model construction, can produce remarkably compact networks, and enhance interpretability through its relationship with decision trees.

For classification tasks, the paper proposes a three-layer neural network architecture comprising: (1) an inter-class separation layer, (2) a class-wise linear separability layer, and (3) a decision layer.

The objective of the first hidden layer is to separate every pair of input samples belonging to different classes. For this reason, a set of hyperplanes is constructed such that at least one hyperplane separates every bi-chromatic pair of input points. Each hyperplane wTx+b=0w^T x + b = 0 is then associated with a neuron whose weight vector and bias are given by

A PREPRINT

normal vector w and bias b, respectively, which collectively form the first layer. Using the step function as an activation function, the first layer thus maps the real-valued feature vectors of the input samples to binary vectors, while preserving their class labels.

The objective of the second hidden layer is to further transform this binary representation into a dataset in which the different classes are linearly separable. Geometrically, this transformation maps the set of labeled vertices of a unit hypercube onto another unit hypercube, potentially of a different dimension, in which the vertices corresponding to each class can be linearly separated from those belonging to other classes.

The third layer makes the final classification decision, using one neuron per class to separate that class from all others with a hyperplane representing the linear decision boundary.

To demonstrate that such three-layer architecture is capable of perfectly classifying any dataset, we present a naive construction. We assume that the input dataset contains no conflicting samples; that is, identical feature vectors are not assigned to different labels.

First, consider binary classification with positive and negative class labels, and let PP and NN denote the sets of positive and negative samples, respectively. The neurons of the first layer are obtained by creating one hyperplane for every distinct bi-chromatic pair (p,n)(p, n), where p∈Pp \in P and n∈Nn \in N, which separates pp and nn (e.g., perpendicular bisector). The neurons of the second layer are obtained by creating one hyperplane for every positive sample of the transformed dataset, that isolates that positive hypercube vertex, being the only one on its positive side. In this way, all negative vertices are mapped to the origin by the second layer. The single output neuron then performs the final linear separation by using a hyperplane that places only the origin on the negative side, effectively implementing an OR operation. This construction achieves perfect classification with ∣P∣∣N∣+∣P∣+1|P||N| + |P| + 1 neurons.

In multi-class classification, first-layer neurons are constructed from hyperplanes that separate every pair of samples belonging to different classes. The second-layer neurons individually isolate the labeled vertices. In the decision layer, one neuron is associated with each class and connected only to the second-layer neurons corresponding to its respective class and implementing an OR operation. This network yields perfect, one-hot-encoded predictions on the training set. The resulting model is, however, also quadratic in size with respect to the number of samples.

Such models are impractical for real-world datasets due to their prohibitive space requirements, and although determining the minimum number of required neurons, i.e. the optimal network, is an NP-hard problem, this paper presents a heuristics to achieve perfect training-set classification with a moderate number of neurons.

Such models are impractical for real-world datasets due to their prohibitive memory requirements. Although finding the optimal network with the minimum number of neurons is an NP-hard problem, this paper proposes heuristics for achieving perfect training-set classification with a moderate number of neurons.

The main contributions of this paper are:

  • proposal of a two-hidden layer neural network capable of perfectly classifying arbitrary finite, non-conflicting training sets;

  • a geometrical construction method that determines the network architecture and neuron parameters directly from the training data;

• efficiently parallelizable technique for constructing substantially more compact networks than the naive construction.

The remainder of the paper is organized as follows. Section 2 presents heuristics for constructing the proposed three-layer neural network for binary classification and evaluates them empirically on the MNIST dataset using an ensemble of binary classifiers. Section 3 extends the method to multi-class classification and evaluates it on the same dataset using a single connected model. Section 4 reviews related work and compares it with our approach. Finally, Section 5 concludes the paper.