Cover: Kvin ruĝaj pomoj. Vektora bildo.
(“Five red apples. Vector Image.” in Esperanto).
No machine-readable author provided.
Maksim assumed (based on copyright claims).
5 January 2006 (original upload date).
Source: Wikimedia Commons.
Maurício Pinheiro
In the field of artificial neural networks, the perceptron is a fundamental model for understanding supervised learning. While traditionally perceptrons are trained using mathematical equations and algorithms, this paper explores an alternative approach to training a perceptron using Excel tables. Specifically, we focus on a two-input neuron with one output neuron, excluding bias and activation functions, and utilize the simplicity and versatility of Excel to demonstrate the process of supervised learning.
Supervised learning is a foundational technique in machine learning where an algorithm learns to make predictions or take actions based on labeled training data. In this learning paradigm, each instance in the training dataset is associated with a known label or target value. These labels provide explicit information about the correct output corresponding to the given input. By leveraging this labeled target information, supervised learning algorithms can generalize patterns and relationships from the training data to make predictions or classifications on unseen data instances. The presence of labeled targets allows the algorithm to optimize its internal parameters and adjust its decision boundaries, aiming to minimize the discrepancy between predicted and true labels. Through iterative learning and feedback, supervised learning algorithms can improve their predictive accuracy and adapt to diverse data patterns, enabling applications in various domains such as image recognition, natural language processing, and predictive modeling
Through this example, we aim to provide a practical understanding of how a perceptron can be trained to add two numbers using tabular data, showcasing its ability to learn linear decision boundaries.
The process of training a perceptron involves adjusting the weights associated with the inputs to minimize the error between the predicted output and the desired output. In the case of our example, the perceptron is tasked with learning to add numbers. By providing input-output pairs that represent different numerical combinations, we can guide the network towards learning the underlying mathematical relationship.
As the training progresses, the perceptron gradually adapts its weights based on the observed errors. It seeks to minimize the discrepancy between the predicted output and the correct output, effectively fine-tuning its internal parameters to approximate the addition operation. Through numerous iterations and adjustments, the perceptron learns to generalize its learning to unseen inputs, becoming proficient at predicting the sum of new numbers.
The successful training of the perceptron network to perform addition would demonstrate the remarkable ability of simple linear models to learn complex functions. It highlights the importance of providing sufficient and representative training data, as well as the iterative nature of the learning process. Moreover, it emphasizes the effectiveness of the Excel-based approach, showcasing how a common spreadsheet software can be utilized as a tool for training neural networks.
1) Defining the NN architeture
The neural network architecture can be defined as follows: it consists of two neurons in the input layer, labeled as y1 and y2. The target value is defined as the sum of y1 and y2. There are two weights associated with the connections between the input neurons and the output neuron, denoted as w1 and w2. The output layer comprises a single neuron, labeled as z, which calculates its output by taking the weighted sum of y1 and y2, that is, z = w1 * y1 + w2 * y2. Notably, this architecture does not include an activation function for the output neuron and does not incorporate bias.

- 2 Neurons in the input layer: y1 and y2
- Target Target = y1 + y2
- 2 Weights for the two connections: w1 and w2
- 1 Neuron in the output layer: z = w1 y1 + w2 y2
- No Activation Function and no bias for the output neuron
2) Initializing random weights
Initializing random weights is an essential step in training a neural network. In our case, we will initialize the weights as 0.4 and 0.6. Random initialization helps introduce diversity and prevents the network from being biased towards a specific initial configuration. By setting the weights to random values, we allow the neural network to explore different weight combinations during the training process. This randomness encourages the network to discover appropriate weight values that lead to accurate predictions. It is important to note that the choice of random weights, in this case, 0.4 and 0.6, is arbitrary but serves as a starting point for subsequent weight adjustments through the learning process.

3) Initializing training input labeled-data
Initializing the training input labeled-data involves defining the number of training epochs and assigning values to each epoch. In this example, we have chosen N, the number of training epochs, as 10, ranging from 0 to 9. Each training epoch represents a single iteration through the training data. For instance, the first epoch corresponds to the input labeled-data at time step 0, the second epoch to time step 1, and so on up to the last epoch at time step 9. The inputs in this case are 1 and 1 and the target 1 + 1 = 2. By structuring the training data in this manner, we establish a sequential order for the input-label pairs and enable the network to learn from each epoch iteratively. Initializing the training input labeled-data with N epochs provides a framework for the neural network to gradually refine its predictions and improve its performance throughout the training process.

4) Feed Foward (z output calculation for Epoch N=0)
During the feed-forward process for Epoch N=0, we calculate the output value z. In this case, the result is z = 1. Considering the neural network architecture where the output neuron computes the weighted sum of the inputs without an activation function, we can substitute the given weights and input values into the equation: z = 0.4 * 1 + 0.6 * 1. Note that the inputs are such that the weighted sum evaluates to 1. This output value represents the prediction made by the neural network for the given input at Epoch N=0.

5) Error calculation (Epoch N=0)
In the error calculation for Epoch N=0, we compare the predicted output z, which is 1 in this case, with the target value, also set as 2 (1+1). By subtracting the target value from the predicted output, we determine the error. In this scenario, the error is calculated as 2 – 1 = 1. This error quantifies the discrepancy between the predicted output and the desired target output for the given input at Epoch N=0.

6) Weights Optimization (Epoch N=0)
In the weights optimization step for Epoch N=0, we update the weights of the neural network using the learning rate (LR=0,01), the input values (y), and the error calculated in the previous step. Specifically, we update the weight w1 using the formula w1 = w1 + LR * y1 * error = 0,4 and w2 = w2 + LR * y2 * error = 0.61.
The learning rate (LR) is a crucial hyperparameter that controls the magnitude of weight adjustments during training. It determines the step size at which the weights are updated based on the calculated error. Finding the optimal learning rate involves various approaches. One common method is to perform a grid or random search over a range of learning rates and evaluate the network’s performance on a validation set. By training with different learning rates and observing the validation accuracy or error, the optimal learning rate can be determined. Alternatively, adaptive learning rate algorithms like Adam or RMSprop can be used, which dynamically adjust the learning rate based on gradient updates and weight adjustment history. These methods automate the process of finding an optimal learning rate without extensive manual tuning. Striking a balance between convergence speed and avoiding instability or slow convergence is essential when determining the optimal learning rate.

7) Weights Backpropagation (Epoch N=0)
In the weights backpropagation step for Epoch N=0, we utilize the optimized weights from the previous epoch to update the network in the current epoch. Backpropagation involves propagating the error from the output layer back through the network, adjusting the weights layer by layer. By carrying forward the optimized weights, we build upon the progress made in the previous epoch, allowing the network to continue learning and improving its predictions. Backpropagation enables the network to iteratively refine its weight values, reducing errors and increasing accuracy as training progresses.

8) Repeat:
The training process involves repeating the following steps until the number of training data in the input batch is exhausted (N epochs = 10 in our case) or until the error reaches a pre-established minimum threshold:
- Feed Forward: The input values are propagated through the network, and the output value z is calculated using the current weights.
- Error Calculation: The error is computed by comparing the predicted output z with the corresponding target value.
- Weights Optimization: The weights are updated using the learning rate (LR), input values (y), and the calculated error. The updated weight value is determined using the formulas w1 = w1 + LR * y1 * error and w2 = w2 + LR * y2 * error. With y1, y2 and the target y1 + y2 of the following line of input data.
- Weights Backpropagation: The updated weights from the current epoch are carried forward to the next epoch. The error is propagated backward through the network, and the weights are adjusted layer by layer using the gradient descent algorithm.

This process is repeated iteratively for each epoch until the desired number of epochs is reached or the error falls below the pre-established minimum threshold. By repeating these steps, the neural network gradually adjusts its weights, minimizing errors, and improving its predictive capabilities.
9) Testing Batch:
To evaluate the performance of the trained neural network, we proceed with the testing phase. This involves the following steps:
- Initializing training input data: We initialize a new set of input data for testing purposes. These inputs may differ from the training data and are used to assess how well the network generalizes to unseen examples.
- Feed Forward: The testing input data is passed through the network using the learned weights. The output value z is calculated for each test instance.
- Error Calculation: The error is computed by comparing the predicted output z with the corresponding target value for the testing data.
- End Testing after 6 inputs: In this scenario, the testing process concludes after 6 epochs. The network has undergone six iterations of the feed-forward and error calculation. The weights have been optimized previously based on the training data, and the network’s performance is evaluated using the testing data.


By concluding the training after 10 epochs, we ensure that the network has had sufficient exposure to the training data to learn patterns and optimize its performance. The testing phase (with six input data sets) allows us to assess how well the network generalizes to new, unseen data and evaluate its overall accuracy and effectiveness in making predictions.
10) If needed, repeat Training with other input data
If necessary, the training process can be repeated with additional or different input data. This provides an opportunity to further improve the performance and generalization ability of the simple perceptron network. By training with a diverse range of input data, the network can learn to handle various patterns and variations, enhancing its overall learning capacity.
The iterative nature of training allows for continuous refinement and adjustment of the network’s parameters based on the new input data. This adaptability ensures that the network becomes more robust and capable of accurately predicting outputs for a wide range of scenarios.
By repeating the training process with different input data, we can explore the network’s ability to learn and generalize beyond the initial training set. This flexibility enables the network to adapt and improve its performance on new and unseen examples, demonstrating the power of supervised learning and the learning capacity of the linear perceptron network.
However, if the network has successfully learned how to add numbers during the training process, it represents a remarkable achievement. This accomplishment showcases the power of supervised learning, where a linear perceptron network without biases or activation functions can approximate mathematical operations. The fact that the network can accurately perform addition demonstrates its capacity to capture and generalize patterns from labeled training data. This achievement highlights the potential of supervised learning algorithms in tackling complex tasks and showcases the capabilities of linear perceptron networks in solving mathematical problems.
Beyond the specific task of addition, the implications of such a successful training extend to various fields where linear operations are required. From financial calculations to data analysis, having a perceptron that can accurately add numbers opens up possibilities for automating and accelerating processes that rely on numerical computations.
In conclusion, if the perceptron network in our example successfully learns to add numbers, it would serve as a testament to the power of supervised learning. It would exemplify the capacity of a linear perceptron, trained using an Excel-based approach, to approximate mathematical operations and highlight its potential applications in various domains. By leveraging the simplicity and versatility of Excel, we demonstrated how to represent tabular data, perform calculations, and iteratively adjust weights to achieve convergence. The accomplishment would not only reinforce our understanding of neural networks but also inspire further exploration into leveraging simple models for solving complex tasks.
This paper serves as a practical guide for understanding supervised learning in the context of a perceptron network. By adopting Excel as a training platform, we hope to make the concept of neural network training more accessible and encourage further exploration in the field of artificial intelligence.
I apologize to English readers for using commas instead of points as a decimal marker in the tables.
We are indebted to Prof. Sandro Jerônimo de Almeida of the Pontifícia Universidade Católica de Minas Gerais (PUC-MG) for sharing his class slides with us. This paper is inspired by one of his class notes: Inteligência Artificial II – Redes Neurais Artificiais.
#LinearPerceptronNetwork #SupervisedLearning #NeuralNetworks #ExcelTables #TrainingAlgorithm #FeedForward #Backpropagation #WeightOptimization #ErrorCalculation #LearningRate #Generalization #MathematicalOperations #PatternRecognition #PredictiveModeling #DataScience #MachineLearning #ArtificialIntelligence #TrainingIterations #Convergence #ModelPerformance #DataAnalysis #LearningFromData #TrainingAccuracy #TestingAccuracy #PatternApproximation

Copyright 2026 AI-Talks.org