# Data Transmission in Wireless Sensor Networks Based on Ant Colony Optimization Technique
## 2 Materials and Methods
### BP Neural Network  
A BP (backpropagation) neural network is a multi-layer feedforward neural network trained using the error backpropagation algorithm, and is the most widely used neural network. As shown in Figure 16:  
Perceptron-a single node in a BP neural network, consisting of input items, weights, biases, activation functions, and outputs. Input node: \(x_{1},x_{2},x_{3},\cdots,x_{i}\);  
Weight: \(w_{1},w_{2},w_{3},\cdots,w_{i}\);  
Bias: \(b\);  
Figure 16: BP (backpropagation) neural network formula. Figure 15: Improved K-means clustering. Ativation function: \(f\);  
Output nodes: \(output\). A BP neural network is a typical nonlinear algorithm. A BP neural network consists of an input hidden layer (also known as an intermediate layer) and an output layer, with one or more hidden layers. Each layer can have several nodes. The connection status of nodes between layers is reflected through weights. There is only one hidden layer in traditional shallow neural networks. There are multiple hidden layers in neural networks for deep learning, as shown in Figure 17:  
Input Layer: The input layer is the starting layer of a neural network, responsible for receiving external input data or features. The number of neurons in the input layer usually corresponds to the number of features in the input data. Hidden Layers: Located between the input and output layers, hidden layers are a crucial part of neural networks for processing information. The hidden layer can have one or more layers, each consisting of a certain number of neurons. Neurons are connected through weights and biases, and nonlinearity is introduced through activation functions. Output Layer: The output layer is the last layer of a neural network, responsible for generating the final output of the network. The number of neurons in the output layer usually corresponds to the number of target variables that need to be predicted. The output layer usually uses the softmax function to convert the output into a probability distribution. For regression problems, the output layer may directly output predicted values. Activation Function: Each neuron in the hidden layer uses an activation function to process its input. Common activation functions include the sigmoid function, ReLU (Corrected Linear Unit) function, Tanh function, etc. The choice of activation function has a significant impact on the performance of the network, as they determine how neurons respond to their inputs. Weights and Biases: Weights and biases are learnable parameters in neural networks used to control the strength of connections and bias terms between neurons. During the training process, these parameters are updated through backpropagation algorithms to minimize the prediction error of the network. The weights and biases are derived from the solution space position and fitness values of the whale algorithm. Backpropagation Algorithm: The backpropagation algorithm is the core algorithm of a BP neural network used to calculate the prediction error of the network and update weights and bias parameters. It adjusts the parameters of the network layer by layer through the backpropagation of error signals, making the output of the network gradually approach the true value. In the process of forward propagation, there is a step that compares whether the expected result is satisfactory or not. In this step, there is an error between the actual output result and the expected output result. In order to reduce this error, this is converted into an  
Figure 17: BP neural network three-layer structure. optimization process. For any optimization problem, there is always an objective function, which is the loss function. The purpose of repeated training is to find the minimum value of this function in order to minimize the error between the actual output result and the expected output result. Each iteration will generate a weight update, and then, the updated weights will be propagated forward with the training samples.