Network traffic prediction method

Through the improved ISSA algorithm, the hyperparameters of the Transformer model are optimized, and the problem of model instability in network traffic prediction is solved, achieving network traffic prediction with higher accuracy and stronger global information capture capabilities.

CN120499113APending Publication Date: 2025-08-15XIAN TECH UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510616614.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-05-14
Publication Date
2025-08-15

AI Technical Summary

Technical Problem

In the prior art, traditional network traffic prediction models are difficult to accurately describe complex network traffic data, and the hyperparameter settings of the Transformer model are very random, resulting in unstable prediction results and easily falling into local optimality.

Method used

The improved Sparrow Search Algorithm (ISSA) combined with the firefly algorithm is used to iterate and optimize the hyperparameters of the Transformer model. By optimizing the hyperparameters of the Transformer model during the training process, including the number of Transformer layers, attention heads, learning rate, batch data size and dropout layers, the model's global search ability and prediction accuracy are improved.

Benefits of technology

It improves the accuracy and stability of the Transformer model in long-term series prediction, reduces the risk of local optimal trapping, and improves the accuracy of network traffic prediction.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120499113A_ABST
    Figure CN120499113A_ABST
Patent Text Reader

Abstract

The invention provides a network traffic prediction method, which comprises the following steps of: acquiring network data under a time sequence from network topology equipment, and preprocessing the network data to obtain preprocessed network data; and inputting the preprocessed network data into a trained Transform prediction model to obtain the network traffic at the current moment. Due to the fact that the Transform prediction model used for predicting the network traffic is obtained by conducting iterative optimization on the hyper-parameters in the model through the ISSA algorithm, the performance of the Transform model in the long-time sequence prediction process is improved, and the Transform model has high prediction precision, is not prone to falling into local optimum and has high global information capturing capacity. Therefore, the precision of predicting the network traffic can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of network security, and in particular relates to a network traffic prediction method. Background Art

[0002] Research on network traffic prediction is categorized into traditional traffic prediction models and deep learning-based traffic prediction models. Traditional network traffic prediction methods fall into three main categories. The first category involves prediction techniques based on mathematical statistical models, such as the Gaussian distribution and the Poisson distribution. These methods were widely used in the early days, but as network traffic data becomes increasingly complex, specific probability distribution models struggle to describe the patterns of complex traffic data, making traffic predictions by these models increasingly inaccurate. The second category involves linear prediction techniques based on machine learning algorithms, including the autoregressive (AR) model, the moving average (MA) model, the autoregressive moving average (ARMA) model, and the autoregressive integrated moving average (ARIMA) model. Network traffic transmitted in modern networks is characterized by nonlinearity, complex composition, and self-similar characteristics. These linear models are generally only suitable for extracting linear feature information from network traffic, not for long-term traffic prediction. The third category is nonlinear prediction techniques based on machine learning algorithms, such as wavelet transform models, fractal autoregressive aggregate sliding models, support vector regression models, Lasso regression, backpropagation neural networks, and XGBoost (Extreme Gradient Boosting). Compared to linear models, these nonlinear models generally achieve higher prediction accuracy for long-term prediction tasks.

[0003] The network traffic forecasting process is essentially a time series analysis of historical network data. The longer the time series, the higher the forecast accuracy. Existing technical solutions utilize the Transformer model for network traffic forecasting. However, the number of neurons in the hidden layer of a standard Transformer neural network is difficult to determine directly, and the number of iterations directly affects the forecasting performance. The parameters of traditional Transformer neural networks are typically manually set based on experience, resulting in a high degree of randomness in the final estimation results. The sparrow search algorithm is a mathematical model based on the foraging behavior of sparrows. It can be categorized as a finder-joiner model and incorporates an early warning mechanism, randomly selecting some sparrows in the population as those alerted to danger, thereby establishing an anti-predator mechanism. While the sparrow search algorithm offers advantages such as strong stability and rapid convergence, it also suffers from limitations such as a tendency to fall into local optima and low convergence accuracy. Summary of the Invention

[0004] In order to solve the above problems existing in the prior art, the present invention provides a network traffic prediction method. The technical problem to be solved by the present invention is achieved through the following technical solutions:

[0005] A network traffic prediction method includes:

[0006] S100, acquiring network data in a time series from a network topology device, and preprocessing the data to obtain preprocessed network data;

[0007] S200, inputting the pre-processed network data into a trained Transformer prediction model to obtain the network traffic at the current moment; wherein, the trained Transformer prediction model is obtained by iteratively optimizing hyperparameters using an ISSA algorithm during a training process.

[0008] Beneficial effects:

[0009] The present invention provides a network traffic prediction method, comprising obtaining network data in a time series from a network topology device, and preprocessing the data to obtain preprocessed network data; inputting the preprocessed network data into a trained Transformer prediction model to obtain the network traffic at the current moment; wherein the trained Transformer prediction model is obtained by iteratively optimizing hyperparameters using the ISSA algorithm during the training process. Since the Transformer prediction model used for prediction in the present invention is obtained by iteratively optimizing the hyperparameters in the model using the ISSA algorithm, the performance of the Transformer model in the long time series prediction process is improved, so that the Transformer model has higher prediction accuracy, is not easily trapped in local optimality, and has stronger global information capture capabilities. Therefore, the present invention can improve prediction accuracy by using this prediction model.

[0010] The present invention will be further described in detail below with reference to the accompanying drawings and embodiments. BRIEF DESCRIPTION OF THE DRAWINGS

[0011] Figure 1 It is a flow chart of a network traffic prediction method provided by the present invention;

[0012] Figure 2 It is a schematic diagram of the process of training the Transformer prediction model provided by the present invention. DETAILED DESCRIPTION

[0013] The present invention will be further described in detail below with reference to specific examples, but the embodiments of the present invention are not limited thereto.

[0014] like Figure 1 As shown, the present invention provides a network traffic prediction method comprising:

[0015] S100, acquiring network data in a time series from a network topology device, and preprocessing the data to obtain preprocessed network data;

[0016] Network data refers to various electronic data processed and generated through the network, such as video data, voice data or text data.

[0017] S200, inputting the pre-processed network data into a trained Transformer prediction model to obtain the network traffic at the current moment; wherein, the trained Transformer prediction model is obtained by iteratively optimizing hyperparameters using an ISSA algorithm during a training process.

[0018] The hyperparameters include: the number of Transformer layers, the number of attention heads, the learning rate, the batch size, the number of dropout layers, and the maximum number of iterations.

[0019] This paper proposes a network traffic prediction algorithm based on the Improved Sparrow Search Algorithm and Transformer (ISSA-Transformer). This algorithm, based on the traditional Sparrow Search Algorithm (SSA), introduces the perturbation principle of the Firefly Algorithm to increase the algorithm's diversity and global search capabilities, thereby better meeting the needs of network traffic prediction.

[0020] The network traffic prediction process is essentially a time series analysis of historical network data. The longer the time series, the higher the prediction accuracy. This paper uses the Transformer model for network traffic prediction. The number of hidden layer neurons in a standard Transformer neural network is difficult to determine directly, and the number of iterations directly affects the prediction results. The parameters of traditional Transformer neural networks are typically manually set based on experience, which results in a high degree of randomness in the final estimation results.

[0021] The present invention addresses these shortcomings by utilizing the firefly algorithm to improve upon it. The specific improvement is as follows: After the sparrow search algorithm completes its search, the firefly perturbation principle is used to perturb and update the positions of the three roles in the sparrow algorithm: explorer, joiner, and early warning. If the post-perturbation position is better than the pre-perturbation position, the sparrow's position is updated; if the post-perturbation position is worse than the pre-perturbation position, the sparrow's position is not updated, and the sparrow continues to perturb until the optimal position is found.

[0022] In the firefly algorithm, each point in the search area represents an individual firefly. The search process is a firefly's use of its luminescence to attract other fireflies toward it. All fireflies update their positions according to the perturbation principle: fireflies with better fitness values correspond to higher brightness. Fireflies with lower brightness are attracted to brighter fireflies and move toward them.

[0023] In a specific embodiment of the present invention, reference Figure 2 , the training process of the Transformer prediction model includes:

[0024] a, obtain the network dataset;

[0025] b. Training a predetermined Transformer prediction model using the network dataset, and iteratively optimizing hyperparameters of the Transformer prediction model using an ISSA algorithm during the training process to obtain optimal hyperparameters;

[0026] c. Using the optimal hyperparameters as the hyperparameters of a predetermined Transformer prediction model to obtain a trained Transformer prediction model.

[0027] The present invention can also use the test set to test the trained Transformer prediction model.

[0028] In a specific embodiment of the present invention, reference Figure 2 , b includes:

[0029] b1, randomly generate a sparrow population, where each sparrow in the population corresponds to a hyperparameter of the Transformer prediction model;

[0030] This implementation initializes the Transformer model's network structure and parameters before generating a sparrow population. The generated parameters are then used to initialize the sparrow population. The sparrow population is X(δ,n,∈,v,γ,θ), where δ represents the number of Transformer layers, n the number of attention heads, ∈ the learning rate, v the batch size, γ the number of dropout layers, and θ the early stopping tolerance (i.e., the maximum number of iterations). The number of sparrows in the sparrow population is the same as the number of hyperparameters.

[0031] b2, randomly selecting discoverers, followers and sentinels from the sparrow population;

[0032] b3, update the positions of the discoverer, follower and sentinel, and calculate the fitness function value of each sparrow after the updated position; wherein, this step can use the root mean square error as the fitness function to calculate the fitness function value of each sparrow after the updated position.

[0033] The formulas for updating the positions of discoverers, followers, and guardians are: the discoverer position update formula, the follower position update formula, and the guardian position update formula respectively;

[0034] The discoverer position update formula is as follows:

[0035]

[0036] where t is the current iteration number, iter ,

[0040] , , , T ,

[0039] , + , , , -1 , , T , , ,

[0041] , represents the maximum iteration number, is a random number uniformly distributed between (0,1], R2 ∈ [0,1], ST ∈ [0.5,1] respectively represent the early warning value and the safety value, Q is a random number subject to a normal distribution, L is a 1×m matrix, and each internal element is 1; when R2 < ST, there is no danger or predator around the sparrow population, and the discoverers widely search for food, thus guiding other individuals to obtain higher fitness values; when R2 ≥ ST, the guardians discover the approaching danger and immediately release a danger signal, and the sparrow population will perform an anti-predation behavior and adjust the search strategy to fly to a safe area; ST represents the safety value, represents at the t th iteration, the position of the i-th sparrow in the k th dimension, and i represents the i th sparrow in the sparrow population.

[0037] The follower position update formula is as follows:

[0038]

[0039] where, are respectively the worst position and the local optimal position of the sparrow individual globally in the t-th iteration and the (t + 1)-th iteration of the sparrow population; A is a multi-dimensional matrix with internal elements of 1 or -1, and A + = A T (AA T ) -1 ; when , it indicates that the i-th sparrow individual is in the worst position and needs to fly to other places to forage for food to obtain higher energy, otherwise the i-th sparrow randomly forages around the current discoverer 's position; represents the position of the i-th sparrow in the j-th dimension of the solution space at the t-th iteration. The guardian position update formula is as follows:

[0040]

[0041] where, is the global optimal position of the current sparrow population, β is the step size control parameter, which is a random number that obeys the normal distribution with mean 0 and variance 1, ε is a constant to avoid the denominator being 0, k∈[-1,1] is used to control the movement direction of the sparrow, and f i is the fitness value of the current sparrow individual i, f g and f w are the optimal fitness value and the worst fitness value of the current sparrow population, Indicates that in the nth iteration, the i-th sparrow is in the solution space k The position in the dimension, μ represents the step size control parameter.

[0042] In step b4, the firefly position is updated using the firefly algorithm's perturbation strategy, using the fitness function value as the corresponding firefly's maximum fluorescence brightness. This is done until the fitness function value of all fireflies is less than the system threshold, resulting in the firefly's global optimal position. If the fitness function value is not less than the system threshold, the corresponding sparrow position is replaced with the updated firefly position, and steps b3-b4 are repeated until the termination condition is met, resulting in the firefly's global optimal position. The termination condition is either achieving the global optimal position or reaching the maximum number of iterations.

[0043] b5, the hyperparameters corresponding to the firefly at the global optimal position are used as the hyperparameters of the predetermined Transformer prediction model.

[0044] In a specific embodiment of the present invention, reference Figure 2 , b4 includes:

[0045] b41, generating a firefly population with the same number as the sparrow population, and making a one-to-one correspondence between the positions of individual sparrows and the positions of individual fireflies;

[0046] This step equates the sparrow individuals in the population to firefly individuals.

[0047] b42, taking the fitness function value of the sparrow individual as the maximum fluorescence brightness of the corresponding firefly, and using the maximum fluorescence brightness to calculate the relative fluorescence brightness and attractiveness of the firefly;

[0048] The formula used in this step to calculate the relative fluorescence brightness and attractiveness of fireflies is:

[0049]

[0050] Where I0 represents the maximum fluorescence brightness, which is the fluorescence brightness of the individual at distance zero, and the individuals with better fitness function values have larger I0 values; γ is the light absorption coefficient; r ij is the spatial distance between fireflies.

[0051] The attraction β is a function of the fluorescence brightness I. β is directly dependent on I, and the exponential decay part of both The same. In the firefly algorithm, the attraction β is directly used to control the movement of fireflies. It represents the attraction strength of one firefly to another. The role of the fluorescence brightness I is indirect. It determines the attraction strength by affecting β. Specifically: I reflects the "brightness" (i.e. fitness) of the firefly. Fireflies with high brightness will attract other fireflies. 2) β quantifies this brightness difference into a specific movement amplitude, combined with the distance γ ij and the maximum attraction β0.

[0052] b43, updating the position of the firefly using the relative fluorescence brightness and attractiveness, and calculating the fitness function value of the updated firefly;

[0053] The formula used to update the position of the firefly is expressed as:

[0054] x i =x i +β·(x j -x i )+α·(rand-1 / 2)

[0055] In the formula, β·(x j -x i ) indicates that firefly I is attracted by firefly J and moves to the position of j. The moving distance is adjusted by β. X i and x j are the spatial positions of firefly i and firefly j respectively, α represents the step size factor of the perturbation, and its value range is [0,1]; rand is a random perturbation factor that obeys a uniform distribution, and its value range is [0,1].

[0056] b44, if the fitness function value in b3 is less than the system threshold, the updated position corresponding to the firefly is taken as the global optimal position.

[0057] During implementation, the learning rate and number of iterations can be selected as hyperparameters, and the steps b1-b5 are then used to complete the training of the Transformer model. The time series network data is then fed into the model, and the self-attention mechanism is used to further extract features and obtain flow values. Furthermore, by constructing the Transformer model and iteratively optimizing its hyperparameters using the ISSA algorithm, the model's performance in long time series forecasting is improved. This Transformer model achieves high prediction accuracy, is less prone to local optima, and exhibits strong search capabilities.

[0058] Although the present application is described herein with reference to various embodiments, those skilled in the art will be able to understand and implement other variations of the disclosed embodiments in practicing the claimed application by reviewing the drawings, the disclosure, and the appended claims. In the claims, the word "comprising" does not exclude other components or steps, and "a" or "an" does not exclude a plurality.

[0059] The above is a further detailed description of the present invention in conjunction with specific preferred embodiments, and the specific implementation of the present invention should not be considered to be limited to these descriptions. For those skilled in the art of the present invention, without departing from the concept of the present invention, several simple deductions or substitutions can be made, which should be considered to fall within the scope of protection of the present invention.

Claims

1. A network traffic prediction method, characterized in that: include: S100, acquiring network data in a time series from a network topology device, and preprocessing the data to obtain preprocessed network data; S200, inputting the pre-processed network data into a trained Transformer prediction model to obtain the network traffic at the current moment; wherein, the trained Transformer prediction model is obtained by iteratively optimizing hyperparameters using an ISSA algorithm during a training process.

2. The network traffic prediction method according to claim 1, characterized in that: The training process of the Transformer prediction model includes: a, obtain the network dataset; b. Training a predetermined Transformer prediction model using the network dataset, and iteratively optimizing hyperparameters of the Transformer prediction model using an ISSA algorithm during the training process to obtain optimal hyperparameters; c. Using the optimal hyperparameters as the hyperparameters of a predetermined Transformer prediction model to obtain a trained Transformer prediction model.

3. The network traffic prediction method according to claim 2, wherein b include: b1, randomly generate a sparrow population, where each sparrow in the population corresponds to a hyperparameter of the Transformer prediction model; b2, randomly selecting discoverers, followers and sentinels from the sparrow population; b3, update the positions of the discoverer, follower and sentinel, and calculate the fitness function value of each sparrow after the updated position; b4, taking the fitness function value as the maximum fluorescence brightness of the corresponding firefly, and using the perturbation strategy of the firefly algorithm to update the position of the firefly until the fitness function value of all fireflies is less than the system threshold, the global optimal position of the firefly is obtained; b5, the hyperparameters corresponding to the firefly at the global optimal position are used as the hyperparameters of the predetermined Transformer prediction model.

4. The network traffic prediction method according to claim 3, characterized in that: The formulas used to update the positions of the discoverer, follower, and sentinel in b3 are: discoverer position update formula, follower position update formula, and sentinel position update formula; The formula for updating the discoverer's position is as follows: where t is the current iteration number, iter max represents the maximum number of iterations, is a random number uniformly distributed between (0,1], R2 ∈ [0,1], ST ∈ [0.5,1] represent the warning value and the safety value respectively, Q is a random number subject to a normal distribution, L is a 1×m matrix, and each internal element is 1; when R2 < ST, there is no danger or predator around the sparrow population, and the discoverers widely search for food, thus guiding other individuals to obtain higher fitness values; when R2 ≥ ST, the early warning discovers that danger is approaching, immediately releases a danger signal, and the sparrow population will make anti-predation behaviors and adjust the search strategy to fly to a safe area; ST represents the safety value, represents the position of the i-th sparrow in the k-th dimension at the t-th iteration, and i represents the i-th sparrow in the sparrow population; The follower position update formula is as follows: in, are the global worst position and local optimal position of the sparrow individual in the tth iteration and t+1th iteration of the sparrow population respectively; A is a multidimensional matrix with internal elements of 1 or -1, and A + =A T (AA T ) -1 ;when When , it indicates that the i-th sparrow individual is in the worst position and needs to fly to other places to forage in order to obtain higher energy, otherwise the i-th sparrow will be in the worst position in the current finder. Random foraging around the location; represents the position of the i-th sparrow in the j-th dimension of the solution space in the t-th iteration; The sentinel position update formula is as follows: in, is the global optimal position of the current sparrow population, β is the step size control parameter, which is a random number that obeys the normal distribution with mean 0 and variance 1, ε is a constant to avoid the denominator being 0, k∈[-1,1] is used to control the movement direction of the sparrow, and f i is the fitness value of the current sparrow individual i, f g and f w are the optimal fitness value and the worst fitness value of the current sparrow population, It represents the position of the i-th sparrow in the k-th dimension of the solution space in the n-th iteration, and μ represents the step size control parameter.

5. The network traffic prediction method according to claim 3, wherein b3 include: The root mean square error is used as the fitness function to calculate the fitness function value of each sparrow after the position is updated.

6. The network traffic prediction method according to claim 3, characterized in that: b4 includes: b41, generating a firefly population with the same number as the sparrow population, and making a one-to-one correspondence between the positions of individual sparrows and the positions of individual fireflies; b42, taking the fitness function value of the sparrow individual as the maximum fluorescence brightness of the corresponding firefly, and using the maximum fluorescence brightness to calculate the relative fluorescence brightness and attractiveness of the firefly; b43, updating the position of the firefly using the relative fluorescence brightness and attractiveness, and calculating the fitness function value of the updated firefly; b44, if the fitness function value in b3 is less than the system threshold, the updated position corresponding to the firefly is taken as the global optimal position.

7. The network traffic prediction method according to claim 6, characterized in that: The formula used in b42 to calculate the relative fluorescence brightness and attractiveness of fireflies is: Where I0 represents the maximum fluorescence brightness, which is the fluorescence brightness of the individual at distance zero, and the individuals with better fitness function values have larger I0 values; γ is the light absorption coefficient; r ij is the spatial distance between fireflies.

8. The network traffic prediction method according to claim 6, characterized in that: The formula used in b43 to update the position of fireflies is: x i =x i +β·(x j -x i )+α·(rand-1 / 2) In the formula, β·(x j -x i ) indicates that firefly i is attracted by firefly j and moves to the position of j. The moving distance is adjusted by β. i and x j are the spatial positions of firefly i and firefly j respectively, α represents the step size factor of the perturbation, and its value range is [0,1]; rand is a random perturbation factor that obeys a uniform distribution, and its value range is [0,1].

9. The network traffic prediction method according to claim 3, characterized in that: After step b4, the network traffic prediction method further includes: If the fitness function value is not less than the system threshold, the corresponding sparrow position is replaced with the updated firefly position, and b3-b4 are repeated until the termination condition is met to obtain the global optimal position of the firefly; The termination condition is to obtain the global optimal position or reach the maximum number of iterations.

10. The network traffic prediction method according to claim 3, wherein: The hyperparameters include: number of Transformer layers, number of attention heads, learning rate, batch size, number of dropout layers, and maximum number of iterations.