A traffic prediction method and related apparatus
By constructing a deep learning architecture that combines temporal and spatial features, the nonlinear mutation adaptability and data sparsity problems in existing traffic prediction technologies are solved, achieving high-precision traffic prediction and reliability assessment, which is suitable for resource scheduling and risk control in complex financial ecosystems.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- ABC FINANCIAL TECH CO LTD
- Filing Date
- 2026-05-13
- Publication Date
- 2026-07-03
AI Technical Summary
Existing technologies struggle to capture nonlinear traffic surges in traffic forecasting, lack flexibility with fixed thresholds, and are ill-suited to complex financial ecosystems. Furthermore, they have insufficient generalization capabilities under sparse or isolated interface analysis, resulting in large prediction errors and failing to meet the demands for high-precision resource scheduling and risk control.
By constructing a deep learning architecture that integrates long-term feature extraction, spatial correlation feature extraction, generative correction layer and fusion layer, iterative training is performed using temporal traffic features and interface spatial features to form a three-in-one collaborative mechanism of temporal-spatial-generative, which dynamically adapts to the complex correlation between multiple interfaces and achieves high-precision prediction.
It achieves high-precision traffic prediction and reliability assessment in complex business environments, can dynamically adapt to complex relationships between multiple interfaces, improves the robustness and prediction accuracy of the model in data-sparse scenarios, and provides data support for resource scheduling and risk prevention and control.
Smart Images

Figure CN122339984A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of software technology, and in particular to a traffic prediction method and related apparatus. Background Technology
[0002] Driven by the digital wave, interfaces, as the core connection carriers for financial services and scenario ecosystems, directly determine service quality and risk control effectiveness through their traffic stability.
[0003] Early traffic management for scenario-based financial interfaces primarily relied on reactive responses, focusing mainly on rule-based approaches and simple statistical models. At the traffic prediction level, traditional statistical methods such as moving averages and exponential smoothing were mainly used to extrapolate future changes by fitting linear trends in historical traffic. Early warning systems depended on fixed threshold settings, such as triggering an alarm when the interface's QPS (queries per second) exceeded a preset value. These solutions failed to capture non-linear traffic surges caused by holiday promotions or policy adjustments, resulting in significant prediction errors. Furthermore, fixed thresholds lacked flexibility, were prone to false alarms due to normal traffic fluctuations, or missed detections due to disguised attack traffic, making them ill-suited to the increasingly complex traffic characteristics of the scenario-based financial ecosystem. Summary of the Invention
[0004] In view of the above problems, this application provides a traffic prediction method and related apparatus to achieve high-precision prediction and reliability assessment of interface traffic in complex business environments. The specific solution is as follows:
[0005] The first aspect of this application provides a traffic prediction method, characterized in that the traffic prediction method includes:
[0006] Obtain the time-series traffic characteristics and interface space characteristics of the target interface;
[0007] The trained traffic prediction model is retrieved. The traffic prediction model is obtained by iteratively training the basic model with the time-series traffic characteristics and interface spatial characteristics of the calibrated interface as training samples and with the goal of making the predicted traffic of the training samples approach its actual traffic.
[0008] The time-series traffic characteristics and interface spatial characteristics of the target interface are input into the traffic prediction model to obtain the predicted traffic of the target interface.
[0009] In one possible implementation, obtaining the temporal traffic characteristics and interface space characteristics of the target interface includes:
[0010] Obtain the call traffic data, interface space data, external impact data, and time period data of the target interface;
[0011] The time-series traffic characteristics of the target interface are constructed based on the call traffic data, the external influence data, and the time period data.
[0012] The interface space features of the target interface are constructed based on the interface space data.
[0013] In one possible implementation, the base model includes a long temporal feature extraction layer, a spatial correlation feature extraction layer, a generative correction layer, a fusion layer, and an output layer.
[0014] In one possible implementation, the process of iteratively training a base model to obtain the traffic prediction model, using the temporal traffic characteristics and interface spatial characteristics of the calibrated interface as training samples and aiming to make the predicted traffic of the training samples approximate its actual traffic, includes:
[0015] Select target samples for this iteration of training from the training samples;
[0016] The long-term time-series feature extraction layer is used to predict the time-series flow characteristics of the target sample to obtain the long-term time-series trend characteristics of the target sample.
[0017] The spatial correlation feature extraction layer is used to predict the long-term trend features and interface spatial features of the target sample to obtain the spatial correlation features of the target sample.
[0018] The generative correction layer is used to conditionally correct the long-term trend features and spatial correlation features of the target sample, thereby obtaining the corrected features and confidence intervals of the target sample.
[0019] The fusion layer fuses the long-term trend features, spatial correlation features, and modified features of the target sample to obtain the comprehensive features of the target sample.
[0020] The predicted flow of the target sample is obtained by predicting the comprehensive features of the target sample through the output layer, and the loss function value of this iteration training is calculated based on the predicted flow and the actual flow of the target sample.
[0021] If the loss function value does not meet the convergence condition, the network parameters of the long-term feature extraction layer, the spatial correlation feature extraction layer, the generative correction layer, and the fusion layer are adjusted, and the step of selecting target samples from the training samples for this iteration of training is returned until the loss function value meets the convergence condition. Then the training ends, and the trained base model is used as the prediction model. The prediction model can simultaneously output the predicted flow and the confidence interval predicted by the generative correction layer.
[0022] In one possible implementation, the step of predicting the long-term trend features and interface spatial features of the target sample through the spatial correlation feature extraction layer to obtain the spatial correlation features of the target sample includes:
[0023] The spatial features of the target sample are used as the input of the graph structure, and the temporal trend features of the target sample are used as the input of the node attributes. The spatial association features of the target sample are obtained by graph attention calculation.
[0024] In one possible implementation, the base model of the generative correction layer is a conditional diffusion model. The step of conditionally correcting the long-term trend features and spatial correlation features of the target sample through the generative correction layer to obtain the corrected features and confidence intervals of the target sample includes:
[0025] During the positive noise addition stage, Gaussian noise is gradually superimposed on the actual flow rate of the target sample according to the diffusion time step to obtain the noise flow rate;
[0026] In the reverse denoising stage, the long-term trend features and spatial correlation features of the target sample are concatenated into global conditional features; the noise flow, the diffusion time step, and the global conditional features are input into the denoising network of the conditional diffusion model to determine the diffusion loss value based on the predicted noise and the Gaussian noise; the denoising network performs local reverse denoising on the global conditional features to obtain the corrected features and confidence interval of the target sample, and the diffusion loss value is the basis for determining the loss function value.
[0027] A second aspect of this application provides a flow prediction device, the flow prediction device comprising:
[0028] The model training module is used to iteratively train the basic model to obtain a traffic prediction model by using the temporal traffic characteristics and interface spatial characteristics of the calibrated interface as training samples and aiming to make the predicted traffic of the training samples approach its actual traffic.
[0029] The traffic prediction module is used to acquire the time-series traffic characteristics and interface spatial characteristics of the target interface; retrieve the trained traffic prediction model; and input the time-series traffic characteristics and interface spatial characteristics of the target interface into the traffic prediction model to obtain the predicted traffic of the target interface.
[0030] A third aspect of this application provides a computer program product including computer-readable instructions that, when executed on an electronic device, cause the electronic device to implement the traffic prediction method of the first aspect or any implementation thereof.
[0031] A fourth aspect of this application provides an electronic device, comprising at least one processor and a memory connected to the processor, wherein:
[0032] The memory is used to store computer programs;
[0033] The processor is used to execute the computer program so that the electronic device can implement the traffic prediction method of the first aspect or any implementation thereof.
[0034] The fifth aspect of this application provides a computer storage medium carrying one or more computer programs that, when executed by an electronic device, enable the electronic device to perform the traffic prediction method described in the first aspect or any implementation thereof.
[0035] By employing the above technical solution, this application provides a traffic prediction method and related apparatus, comprising: acquiring the temporal traffic characteristics and interface spatial characteristics of a target interface; retrieving a trained traffic prediction model, wherein the traffic prediction model is obtained by iteratively training a basic model using the temporal traffic characteristics and interface spatial characteristics of a calibrated interface as training samples, with the goal of the predicted traffic of the training samples approximating its actual traffic; and inputting the temporal traffic characteristics and interface spatial characteristics of the target interface into the traffic prediction model to obtain the predicted traffic of the target interface. This application constructs the temporal traffic characteristics and interface spatial characteristics of the target interface, forming a complete input system covering temporal evolution patterns and spatial topological relationships. The trained traffic prediction model performs feature recognition on the input temporal traffic characteristics and interface spatial characteristics to obtain the corresponding predicted traffic. Through this time-space-generation three-in-one collaborative mechanism, the model can dynamically adapt to the complex relationships between multiple interfaces, achieving high-precision prediction and reliability assessment of interface traffic in complex business environments, providing data support for resource scheduling and risk prevention and control. Attached Figure Description
[0036] The above and other features, advantages, and aspects of the embodiments of this disclosure will become more apparent from the accompanying drawings and the following detailed description. Throughout the drawings, the same or similar reference numerals denote the same or similar elements. It should be understood that the drawings are schematic, and the originals and elements are not necessarily drawn to scale.
[0037] Figure 1 A flowchart illustrating a traffic prediction method provided in an embodiment of this application;
[0038] Figure 2 This is a partial flowchart illustrating a traffic prediction method provided in an embodiment of this application;
[0039] Figure 3This is another schematic flowchart of a traffic prediction method provided in an embodiment of this application;
[0040] Figure 4 This is a schematic diagram of the structure of a flow prediction device provided in an embodiment of this application;
[0041] Figure 5 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation
[0042] The embodiments of this application are described below with reference to the accompanying drawings. The terminology used in the implementation section of this application is for explaining specific embodiments only and is not intended to limit the scope of this application.
[0043] The embodiments of this application will now be described with reference to the accompanying drawings. Those skilled in the art will recognize that, with technological advancements and the emergence of new scenarios, the technical solutions provided in the embodiments of this application are equally applicable to similar technical problems.
[0044] The terms "first," "second," etc., used in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such terms are interchangeable where appropriate; this is merely a way of distinguishing objects with the same attributes in the embodiments of this application. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion, so that a process, method, system, product, or apparatus that comprises a series of elements is not necessarily limited to those elements, but may include other elements not explicitly listed or inherent to those processes, methods, products, or apparatuses.
[0045] In digital financial services scenarios, interfaces serve as the core carriers connecting the business ecosystem, and their traffic stability directly impacts service quality and risk control effectiveness. Existing traffic prediction technologies largely rely on traditional statistical methods such as moving averages and exponential smoothing, or on single machine learning models like LSTM and random forests. However, facing the increasingly complex business forms of scenario-based finance, existing technologies have significant limitations: on the one hand, traditional models struggle to capture nonlinear, long-cycle traffic surges caused by holiday promotions and policy adjustments, leading to large long-term trend prediction errors; on the other hand, existing solutions often analyze historical data of individual interfaces in isolation, lacking the ability to mine dynamic spatial relationships between multiple third-party interfaces, and cannot adapt to the needs of multi-interface collaborative scheduling; furthermore, in scenarios with cold starts of new interfaces or sparse data, discriminative models relying on complete historical data have insufficient generalization ability, easily generating large prediction biases, and failing to meet the actual needs of high-precision resource scheduling and anomaly early warning.
[0046] To address the aforementioned problems, this application provides a traffic prediction method. The traffic prediction method of this application embodiment will be described in detail below with reference to the accompanying drawings.
[0047] See Figure 1 , Figure 1 This is a flowchart illustrating a traffic prediction method provided in an embodiment of this application. Figure 1 As shown in the embodiment of this application, a traffic prediction method may include steps S101 to S103, which are described in detail below.
[0048] S101, obtain the timing traffic characteristics and interface space characteristics of the target interface.
[0049] In this embodiment, by collecting, cleaning, and constructing interface data, the temporal traffic characteristics and interface spatial characteristics of the target interface can be obtained. The temporal traffic characteristics characterize the pattern of interface call volume changes over time and can be constructed based on raw call traffic data aggregated from interface gateway logs, API management platform monitoring logs, and call billing records, combined with time period data and external influence data. The interface spatial characteristics characterize the topological structure and dependencies between the target interface and other related interfaces and can be constructed based on the historical call sequence correlation between interfaces, the industry type of the interface, and the interface call priority.
[0050] Specifically, time-series traffic features include lag features (such as call volume in the previous 1, 7, and 30 steps), rolling statistical features (such as mean and variance under a 7- or 30-step window), and periodic features (such as hourly, weekly, monthly, and seasonal markers), used to characterize the short-term memory, local trend fluctuation intensity, and intraday, weekly, and seasonal patterns of the interface. Interface spatial features specifically include an adjacency matrix constructed with interfaces as nodes and interface association degrees as edge weights, as well as encoded node attribute features (such as industry type vectors and priority vectors), used to express the spatial dependencies between multiple interfaces. Through this joint construction of multi-dimensional features, the evolutionary trend of interfaces in the time dimension and their collaborative state in the spatial dimension can be comprehensively characterized, providing rich information input for subsequent model inference.
[0051] In one possible implementation, a multi-source fusion feature construction mechanism ensures that time-series traffic features not only include the statistical regularities of historical data but also explicitly incorporate abrupt change factors and periodic constraints from the business scenario, significantly enhancing the model's ability to capture non-stationary traffic signals. Furthermore, transforming discrete interface information into a machine-understandable graph topology explicitly reveals the spatial dependencies between multiple interfaces, providing the necessary structured input for subsequent dynamic mining of the influence weights between interfaces. See also Figure 2 , Figure 2This is a partial flowchart illustrating a traffic prediction method provided in an embodiment of this application. Figure 2 As shown in the embodiment of this application, a traffic prediction method is provided, wherein step S101, "obtaining the time-series traffic characteristics and interface spatial characteristics of the target interface", may include steps S201 to S203, which are described in detail below.
[0052] S201, obtain the call traffic data, interface space data, external impact data, and time period data of the target interface.
[0053] In this embodiment, the call traffic data can characterize the call status of the corresponding interface in the historical and current time period. It can be formed by summarizing the interface gateway log, API management platform monitoring log and call billing flow. Specifically, it includes fields such as interface identifier, timestamp, number of calls per unit time, call success rate and average response time. The statistical granularity can be set to 5 minutes, hour, day or week according to actual business needs.
[0054] Interface space data is used to describe the topological relationship and attribute characteristics between the interface and other related interfaces. It comes from the interface information database, service catalog configuration and historical call sequence analysis. Specifically, it includes the correlation between interfaces (calculated by historical co-occurrence frequency or call dependency relationship), the industry type of the interface, and the interface call priority.
[0055] External impact data refers to macroscopic or microscopic environmental factors that can cause traffic fluctuations, excluding the interface's own operational status. These factors originate from operational schedules, work order systems, third-party notifications, and statutory holiday calendars. Specifically, external impact data includes third-party business activity markers, holiday information (including time off arrangements), and industry peak / off-peak season coefficients.
[0056] Time-period data refers to derived variables used to characterize the periodicity of time series. They are directly mapped from the original timestamps and specifically include hourly features, weekday features, monthly features, and seasonal features.
[0057] In practical applications, for collected call traffic data, interface space data, external impact data, and time period data, the 3σ principle can be used to correct abnormal traffic values, and a small number of missing values can be filled by linear interpolation combined with the Prophet model. Specifically, the 3σ principle is first used for initial screening of outliers, and then a secondary judgment is made by combining temporal neighborhood and business context. Severe anomalies are retained and anomaly marker features are added. Missing values are processed in layers according to the size of the missing value and the temporal structure. Specifically, a small number of short missing values are filled by linear interpolation, periodic missing values are filled by Prophet, and for cases with many missing values or cold start scenarios of new interfaces, the missing value mask is retained and generative correction is performed by the subsequent generative correction layer.
[0058] S202, construct the time-series traffic characteristics of the target interface based on call traffic data, external influence data, and time period data.
[0059] In this embodiment, the time-series traffic feature is a comprehensive vector representation that integrates the historical fluctuation patterns of the interface, the impact of external events, and the time periodicity. It can be obtained by structuring and splicing features based on call traffic data, external impact data, and time periodic data.
[0060] Specifically, lag features and rolling statistical features are constructed based on call traffic data. Lag features include call volumes from the previous 1, 7, and 30 steps, used to characterize short-term memory and long-term dependence. Rolling statistical features include the mean and variance calculated under a 7-step or 30-step sliding window, used to quantify the strength and amplitude of local trends. Secondly, external influence data is encoded as categorical variables or continuous coefficients. For example, promotional activities are marked as high-intensity event features, statutory holidays are mapped to specific holiday factors, and industry peak and off-peak seasons are normalized into intensity coefficients. Thirdly, periodic embedding vectors are generated using time-period data to express intraday peaks, intraweek troughs, and seasonal patterns. Finally, cleaned anomaly markers (determined based on the 3σ principle) are incorporated as auxiliary features, and all continuous variables are standardized using normalized parameters fitted to the training set. Categorical variables are encoded using one-hot encoding or embedding encoding. For example, when predicting the traffic of a payment interface during the Spring Festival, the system automatically extracts the average daily call volume of the interface over the past 30 days (lagging feature), the Spring Festival holiday marker (external influence), and the lunar month code (time period), and concatenates the three to form a time-series traffic feature.
[0061] S203, construct the interface space characteristics of the target interface based on the interface space data.
[0062] In this embodiment, the interface space features are graph structure data expressing the topological structure and node attributes among multiple interfaces, obtained by constructing an adjacency matrix and a node attribute matrix based on the interface space data. Specifically, an initial adjacency matrix is constructed using the interface as the node and the correlation between interfaces as the edge weight. During the construction process, a threshold can be set to filter out weakly correlated edges, retaining only the neighbor node connections that have a significant impact on the traffic of the current target interface. Simultaneously, attribute information such as the industry type and call priority of the interface is vectorized and concatenated with the traffic statistics features of the node to form the node input matrix of the graph neural network.
[0063] In practical applications, continuous variables are fitted with normalized parameters on the training set; categorical variables are only encoded without scaling. The multi-dimensional feature system obtained and constructed through the above steps achieves the organic synergy between temporal dynamic information and spatial static structure. Deep fusion of traffic data, external influence data, and time-period data ensures that time-series traffic features can accurately respond to nonlinear traffic mutations caused by holiday promotions, policy adjustments, etc., solving the problem that traditional single time series models cannot capture external disturbances. Meanwhile, interface spatial features constructed based on interface spatial data transform isolated interface predictions into joint inference based on graph topology, enabling the model to use traffic changes in neighboring interfaces to correct prediction biases of the target interface. Together, these constitute a dual-driven input mode of temporal and spatial data, which not only improves the model's robustness in data-sparse scenarios but also provides a standardized and information-complete feature base for the parallel processing of subsequent long-term feature extraction layers and spatial correlation feature extraction layers, thereby significantly improving the overall accuracy and reliability of traffic prediction.
[0064] S102, retrieve the trained traffic prediction model. The traffic prediction model is obtained by iteratively training the basic model with the time-series traffic characteristics and interface spatial characteristics of the calibrated interface as training samples and with the goal of making the predicted traffic of the training samples approach its actual traffic.
[0065] In this embodiment, the base model is a deep learning architecture that integrates long-term temporal feature extraction, spatial correlation mining, and generative correction capabilities. The training process of the traffic prediction model is based on historical data from a large number of calibrated interfaces, covering various scenarios with different industries, activity levels, and data completeness. Training samples consist of temporal traffic features and interface spatial features from the calibrated interfaces, labeled with the corresponding real traffic data. The training objective is to minimize the error between predicted and actual traffic, iteratively updating the network parameters and dynamic fusion weights of each layer in the base model through a backpropagation algorithm. For example, during the training phase, data from a cross-border payment interface over the past year is selected as samples. By continuously adjusting the weight parameters of the model's internal attention mechanism, the predicted values output by the model gradually converge to the actual cross-border settlement traffic.
[0066] The traffic prediction model not only learns the long-term dependencies of time-series data but also grasps the spatial linkage patterns between multiple interfaces and possesses the ability to correct data sparsity or anomalous distributions through generative mechanisms. By calling a fully trained model, the prediction engine is ensured to have the generalization ability to handle long-term, multi-correlation, and data sparsity problems in complex financial scenarios, laying the foundation for high-precision prediction.
[0067] In one possible implementation, the base model may include a long-term temporal feature extraction layer, a spatial correlation feature extraction layer, a generative correction layer, a fusion layer, and an output layer. Specifically:
[0068] The long-term feature extraction layer is used to capture long-term dependencies and periodic trends in target interface traffic data. This includes an encoder-decoder structure based on a sparse attention mechanism, an improvement on the traditional Transformer architecture, designed to address the vanishing gradient problem in recurrent neural networks when processing long sequences. By selecting attention weights at key time steps and ignoring redundant information, the long-term feature extraction layer extracts long-term trend features representing monthly or quarterly traffic changes. The attention mask can be dynamically adjusted according to the length of the period to be predicted, automatically focusing on statistically significant time nodes as the input sequence length increases. For example, when predicting interface traffic during e-commerce promotional periods, the long-term feature extraction layer can automatically identify and amplify the peak features of the same period last year while ignoring noise interference from daily fluctuations. Through this sparse attention mechanism, the long-term feature extraction layer effectively reduces computational complexity while significantly improving the accuracy of capturing long-term traffic trends, providing a stable temporal benchmark for subsequent spatial correlation analysis.
[0069] The spatial association feature extraction layer is used to mine the dynamic topological relationships and mutual influence weights between different interfaces. This includes a graph attention network structure, composed of multiple stacked graph attention layers. The structure treats interfaces as nodes in a graph and the call correlation between interfaces as edge connections. The spatial association feature extraction layer calculates the contribution weights of neighboring nodes to the current node through a multi-head attention mechanism, and then aggregates these to obtain spatial association features representing the synergistic effect of multiple interfaces. The edge weights of the adjacency matrix can be dynamically updated based on historical call logs. When the frequency of linked calls between two interfaces changes, the attention weights are adjusted accordingly. For example, in cross-border payment scenarios, when the traffic to the exchange rate query interface surges, the spatial association feature extraction layer can automatically increase its influence weight on the cross-border transfer interface, thereby accurately capturing this cross-interface transmission effect. By dynamically allocating attention weights, the spatial association feature extraction layer overcomes the shortcomings of fixed-weight models that cannot adapt to changes in business scenarios, achieving real-time perception of spatial dependencies in complex interface ecosystems.
[0070] The input to the spatial association feature extraction layer includes interface spatial features and long-term trend features. The calculation process is as follows: first, the interface spatial features and long-term trend features are mapped to a unified feature space; then, the association score between the current interface and its neighboring interfaces is calculated, followed by normalization within the neighborhood to obtain the neighbor influence weights; finally, the neighbor features are weighted and aggregated according to the weights to form the spatial association feature representation of the current interface. If a multi-head attention mechanism is adopted, multiple sets of weights are calculated in parallel and then fused to improve the stability and generalization ability of the representation. This mechanism can dynamically reflect the changes in the influence intensity between interfaces and support multi-interface collaborative scheduling.
[0071] The generative correction layer addresses data sparsity, missing data anomalies, and corrects prediction biases. It includes a conditional diffusion model, consisting of a forward noise generation process and a backward denoising network. The generative correction layer concatenates long-term trend features and spatial correlation features into global conditional features. In the forward phase, Gaussian noise is superimposed on real traffic samples to learn data distribution patterns. In the backward phase, the global conditional features guide the denoising network to gradually recover the data, thereby generating traffic distributions for missing time periods or newly added interfaces, and outputting corrected feature vectors and confidence intervals. The generative correction layer dynamically switches its operating mode based on the completeness of the input data: for samples with complete data, fine-tuning is performed to eliminate accumulated errors; for newly added interface samples with missing data or cold starts, full generation is performed to fill data gaps. For example, when a newly connected third-party interface lacks historical data, the generative correction layer can generate a reasonable initial traffic distribution based on the spatiotemporal characteristics of similar interfaces, preventing the model from failing due to input deficiencies. By introducing the generative correction mechanism, the generative correction layer significantly improves the model's robustness in scenarios with incomplete data and provides the ability to quantify prediction uncertainty.
[0072] The fusion layer integrates multi-source heterogeneous features and eliminates feature conflicts. It includes a learnable weight parameter module and a normalization function unit. The fusion layer normalizes the preset learnable weight parameters using the Softmax function, adaptively adjusting the weight ratios based on the contribution of each feature to the current prediction task, and linearly weighting and fusing the three into a comprehensive feature vector. For example, in highly time-sensitive scenarios such as holidays, the fusion layer automatically increases the weight of long-term trend features; while in scenarios involving multiple interfaces triggered by sudden hot events, it increases the weight of spatial correlation features. Through this dynamic fusion strategy, the fusion layer can achieve complementary enhancement of features from different dimensions, avoiding the feature overload problem caused by simple concatenation, and ensuring the comprehensiveness and accuracy of the comprehensive feature representation.
[0073] The output layer maps high-dimensional integrated features to specific traffic values and reliability ranges, and includes a fully connected network and activation function units. The output layer performs a nonlinear transformation on the integrated feature vector output by the fusion layer, directly regressing to obtain the predicted traffic value for the target interface. Combined with the confidence interval predicted by the generative correction layer, it ultimately outputs the predicted traffic value and its corresponding uncertainty range. For example, the output layer not only provides a predicted call volume of 10,000 for a certain interface tomorrow, but also simultaneously outputs a 95% confidence interval of [9500, 10500], indicating the reliability of the prediction. Through this dual-output mechanism, the output layer satisfies both the resource scheduling requirement for specific values and provides a quantitative basis for risk warning, achieving the final transformation from feature representation to business decision-making.
[0074] This application addresses the challenge of single models simultaneously handling long-term temporal feature extraction and spatial correlation feature extraction layers. Building upon this, a generative correction layer conditionally reconstructs the distribution of features output from the first two layers, effectively mitigating information gaps caused by data sparsity and missing data. Furthermore, an adaptive weighting mechanism in the fusion layer deeply integrates temporal, spatial, and corrected generative features, eliminating potential conflicts between multi-source features. Finally, the output layer achieves accurate quantitative regression and uncertainty assessment. This progressive architecture enables the model to maintain high adaptability and prediction accuracy even in complex scenarios such as long-period fluctuations, multi-interface linkages, and incomplete data, significantly outperforming traditional single-temporal-series prediction models.
[0075] See Figure 3 , Figure 3 This is another schematic flowchart illustrating a traffic prediction method provided in an embodiment of this application. Figure 3 As shown in the embodiment of this application, a traffic prediction method is provided. The process of iteratively training a basic model to obtain a traffic prediction model by using the time-series traffic characteristics and interface spatial characteristics of the calibrated interface as training samples and aiming to make the predicted traffic of the training samples approach its actual traffic may include steps S301 to S307. These steps are described in detail below.
[0076] S301, Select the target sample from the training sample for this iteration of training.
[0077] In this embodiment, the training samples are a dataset consisting of the temporal traffic characteristics and interface spatial characteristics of the calibrated interfaces. These data have been cleaned, normalized, and partitioned into sparse subsets before being input into the model. Based on the current iteration, a portion of the training samples is randomly selected or loaded in batches as target samples. These target samples include the interface call volume within a specific time window, the associated interface topology, and external influencing factors. The selection process can employ a mini-batch gradient descent strategy, where a fixed number of samples are drawn from the full training set each time as target samples to balance computational efficiency with the accuracy of gradient estimation.
[0078] S302 predicts the time-series flow characteristics of the target sample through a long-term feature extraction layer, thereby obtaining the long-term trend characteristics of the target sample.
[0079] In this embodiment, to address the gradient vanishing problem in traditional recurrent neural networks when processing long sequences, the long-term temporal feature extraction layer is constructed based on the Informer architecture. The long-term temporal feature extraction layer receives the temporal flow features of the target sample, utilizes a sparse attention mechanism to filter out the key time positions that contribute most to the current prediction, and ignores redundant historical information, thereby efficiently capturing long-term dependencies at the monthly or quarterly levels. Specifically, the input sequence is mapped to a high-dimensional feature space, and global temporal information is aggregated through a multi-head attention mechanism to output a feature vector that condenses long-term trend information.
[0080] It should be noted that long-term trend features refer to the latent vectors formed after encoding, which characterize the evolution pattern, periodic fluctuations, and overall growth or decline trends of interface traffic over a long period. For example, for e-commerce payment interfaces, the long-term feature extraction layer can automatically focus on high-traffic time points in the same historical period, extracting significant periodic upward trend features while ignoring minor random fluctuations in daily life. This provides a time benchmark with a global perspective for subsequent spatial correlation analysis, ensuring that the model does not deviate from the long-term trend due to short-term noise.
[0081] S303 uses a spatial correlation feature extraction layer to predict the long-term trend features and interface spatial features of the target sample, thereby obtaining the spatial correlation features of the target sample.
[0082] In this embodiment, the spatial correlation feature extraction layer is constructed based on a graph attention network to mine the dynamic spatial dependencies between multiple third-party interfaces. The input of the spatial correlation feature extraction layer includes, on the one hand, long-term trend features, which are used as attribute information of nodes in the graph; on the other hand, it includes the interface spatial features of the target sample, which are represented as an adjacency matrix with interfaces as nodes and the correlation degree between interfaces as edge weights, serving as the structural information of the graph.
[0083] Specifically, the spatial correlation feature extraction layer maps long-term trend features to query vectors and key-value vectors. Then, it calculates attention coefficients within the neighborhood defined by the graph structure. These coefficients dynamically represent the importance weights of neighboring interfaces to the current interface. Subsequently, these weights are used to weighted aggregate the features of neighboring nodes to generate the current spatial correlation features. For example, when traffic to a loan application interface surges, traffic to a strongly correlated risk control query interface often fluctuates accordingly. The spatial correlation feature extraction layer can automatically identify and assign a higher attention weight to the risk control interface, thus incorporating this spatial linkage information into the feature representation. Through the synergy of long-term trend features and interface spatial features, not only is the inertia of the time dimension considered, but also the interaction of the spatial dimension is introduced, significantly improving the feature representation capability in multi-interface collaboration scenarios.
[0084] It should be noted that spatial association features can refer to node representation vectors calculated through attention mechanisms that incorporate the influence of neighboring nodes. These vectors reflect the degree to which the current interface traffic is affected by other associated interfaces (such as payment interfaces and logistics interfaces within the same ecosystem).
[0085] S304 uses a generative correction layer to conditionally correct the long-term trend features and spatial correlation features of the target sample, thereby obtaining the corrected features and confidence intervals of the target sample.
[0086] In this embodiment, the generative correction layer is constructed based on a conditional diffusion model, primarily used to handle scenarios with sparse, missing, or abrupt data changes, and to provide probabilistic uncertainty assessment. The generative correction layer receives long-term trend features and spatial correlation features, concatenating them as global conditional features to guide the denoising process. The generative correction layer comprises two stages: forward noise addition and reverse denoising. During training, the forward stage progressively adds Gaussian noise to the real traffic of the target sample until it becomes pure noise; the reverse stage inputs the noise, diffusion time step, and the aforementioned global conditional features into the denoising network, learning how to recover the true data distribution from the noise. Through this conditional generation mechanism, the model can learn a reasonable distribution pattern of traffic data given a long-term temporal and spatial context. For example, for newly connected, cold-start interfaces without historical data, traditional discriminative models may fail to output effective predictions, while the generative correction layer can use conditional features to guide the denoising network to generate a traffic distribution that conforms to the general industry patterns of such interfaces, while simultaneously outputting a wider confidence interval to indicate high risk. Complementing the aforementioned feature extraction steps, it utilizes generative capabilities to fill the blind spots of deterministic prediction and provides a basis for risk quantification.
[0087] It should be noted that the corrected features can refer to the feature representation that is restored by the denoising network and is more consistent with the actual data distribution, which corrects the bias caused by missing or abnormal data; the confidence interval is the probability distribution range obtained based on random sampling of the generation process, which is used to quantify the credibility of the prediction results.
[0088] S305 uses a fusion layer to fuse the long-term trend features, spatial correlation features, and modified features of the target sample to obtain the comprehensive features of the target sample.
[0089] In this embodiment, the fusion layer is configured with learnable weight parameters to adaptively integrate feature information from different modules, thereby resolving potential conflicts or redundancy issues arising from multi-source features. The fusion layer receives long-term trend features, spatial correlation features, and corrected features from the target sample. It normalizes the preset weight parameters using the Softmax function and calculates the weighted sum of each feature vector. During training, the weight parameters are automatically updated based on the contribution of each layer to the final prediction error: if long-term features are more accurate in a certain scenario, their corresponding weights increase; if severe data loss makes generative corrected features more critical, their weights increase accordingly. For example, during normal stable operation, long-term trend features may dominate the weights; however, when sudden promotional activities cause drastic changes in data distribution, the weights of generative corrected features automatically increase to correct biases. This dynamic fusion mechanism ensures that the model can utilize the most effective feature combinations in different business scenarios, avoiding the limitations of manually setting fixed weights and achieving optimal complementarity at the feature level.
[0090] It should be noted that comprehensive features can refer to the final high-level semantic representation that integrates long-term temporal trends, spatial correlation dynamics, and generative correction information, which combines long-term temporality, spatial correlation, and distributional robustness.
[0091] S306 predicts the target sample's flow rate by using the output layer to predict the comprehensive features of the target sample, and calculates the loss function value for this iteration of training based on the predicted and actual flow rates of the target sample.
[0092] In this embodiment, the output layer typically consists of a fully connected layer and an activation function, responsible for mapping the high-dimensional comprehensive features back to a specific traffic value space. The predicted traffic is the point estimate output by the model, representing the most likely number of interface calls under the current conditions; the loss function value is a scalar that measures the difference between the predicted traffic and the actual traffic, used to guide the optimization direction of the model parameters. Specifically, the output layer performs linear transformation and nonlinear activation on the comprehensive features, outputting the final prediction result; subsequently, loss functions such as mean squared error or mean absolute error are used to calculate the difference between the predicted value and the actual traffic labels in the training samples. In addition, since the generative correction layer participates in the training, the calculation of the loss function may also include a diffusion loss term, which measures the difference between the noise predicted by the denoising network and the actual added noise. This term serves as a regularization constraint, prompting the generative module to better learn the data distribution.
[0093] S307. If the loss function value does not meet the convergence condition, adjust the network parameters of the long-term feature extraction layer, spatial correlation feature extraction layer, generative correction layer and fusion layer, and return to step S301 until the loss function value meets the convergence condition. Then, end the training and use the trained base model as the prediction model. The prediction model can simultaneously output the predicted flow and the confidence interval predicted by the generative correction layer.
[0094] In this embodiment, the convergence condition can be that the loss function value drops below a preset threshold, or that the loss value no longer decreases significantly in multiple consecutive iterations. Parameter adjustment is achieved through the backpropagation algorithm, that is, based on the gradient of the loss function value with respect to the parameters of each network layer, the weight matrix and bias terms of the long-term feature extraction layer, spatial correlation feature extraction layer, generative correction layer, and fusion layer are updated using an optimizer (such as Adam). This process is a closed-loop iterative optimization mechanism, that is, each return to the sample selection step means entering a new round of training iteration. The model repeats the above feature extraction, fusion, prediction, and error calculation process on the new batch of samples, and continuously fine-tunes the internal parameters. As the number of iterations increases, the model gradually learns how to more accurately capture long-term patterns, more dynamically mine spatial correlations, and more effectively correct data defects, so that the predicted traffic approaches the real traffic infinitely. In particular, since the generative correction layer participates in the entire training process, the final prediction model not only has high-precision point prediction capabilities, but also retains the probabilistic inference characteristics of the generative model, and can synchronously output the predicted traffic and its corresponding confidence interval during the inference stage.
[0095] In this embodiment, the long-term feature extraction layer provides a macroscopic time trend benchmark for the entire model, avoiding the misleading effects of local fluctuations. The spatial correlation feature extraction layer introduces multi-dimensional spatial interaction information, enhancing the model's ability to perceive the linkage effects of multiple interfaces. The generative correction layer further utilizes a conditional diffusion mechanism to perform targeted distribution learning and correction for data sparsity and abrupt change scenarios, compensating for the shortcomings of traditional discriminative models. These three layers form an organic whole through the dynamic weight allocation mechanism of the fusion layer. During training, the errors of each layer are jointly backpropagated through a unified loss function, forcing the parameters of each layer to adapt to each other and jointly minimize prediction bias. Therefore, when facing complex scenarios common in interface integration platforms, such as long-cycle planning, multi-party collaborative scheduling, and cold start of new interfaces, the model can significantly improve prediction accuracy and provide reliable confidence intervals to assist decision-making, effectively solving the problems of weak generalization ability and poor adaptation to extreme scenarios in existing technologies.
[0096] In one possible implementation, the above step S303, "predicting the long-term trend features and interface spatial features of the target sample through the spatial correlation feature extraction layer to obtain the spatial correlation features of the target sample," can be implemented using the following steps:
[0097] The spatial features of the target sample are used as the input of the graph structure, and the temporal trend features of the target sample are used as the input of the node attributes. The spatial correlation features of the target sample are obtained by graph attention calculation.
[0098] In this embodiment, interface spatial features define the basic connection framework for edges and nodes in a graph neural network, representing fixed or semi-static spatial constraints within the interface ecosystem. Temporal trend features, as dynamic attributes of each node in the graph structure, provide time-dimensional contextual information for subsequent spatial aggregation. By mapping interface spatial features to an adjacency matrix of the graph and temporal trend features to a feature matrix of nodes, a directed or undirected graph structure is constructed, with interfaces as nodes and inter-interface relationships as edges. This combination of graph structure and node attributes allows discrete interface data to be transformed into a unified topological representation suitable for graph neural network processing.
[0099] Furthermore, the spatial association features of the target sample are obtained through graph attention calculation. Graph attention calculation refers to the process of automatically learning and assigning influence weights between adjacent nodes in a graph using a graph attention network mechanism. This calculation is performed based on the node attributes (i.e., sequential trend features) and graph structure (i.e., interface spatial features) of the target sample. Specifically, for each target interface node in the graph, its own temporal trend features are first concatenated or linearly transformed with the temporal trend features of all its neighboring nodes. Then, a shared attention mechanism function is used to calculate the correlation score between the two. Furthermore, the Softmax function is used to normalize the correlation scores of all neighbors of the target node to obtain the attention weight coefficient of each neighboring node for the target node. This attention weight coefficient is dynamically generated and can be adaptively adjusted according to the actual distribution of the current input data. It can accurately select the key neighboring interfaces that have the greatest impact on the current interface traffic prediction based on the similarity or complementarity of temporal features, while suppressing the interference of irrelevant or noisy interfaces. Finally, the calculated attention weight coefficients are used to perform weighted summation and aggregation of the temporal trend features of all neighboring nodes, thereby generating a spatial correlation feature that integrates the information of surrounding interfaces. This spatial correlation feature not only retains the temporal regularity of the target interface itself, but also embeds spatial context information from highly correlated neighboring interfaces. This attention-based dynamic aggregation method enables adaptive capture of complex coupling relationships between multiple third-party interfaces, effectively solving the problem that traditional fixed-weight models cannot adapt to dynamic changes in interface associations, and significantly improving the accuracy and generalization ability of spatial feature representation.
[0100] In this embodiment, by using the temporal trend features output from the long-term feature extraction layer as node attributes of the graph neural network, and combining them with the graph structure input constructed from interface spatial features, the computation of spatial correlation features no longer relies on static rule settings, but is entirely dominated by a data-driven attention mechanism. This design enables the model to dynamically adjust the dependency weights between different interfaces based on real-time traffic trend changes, thus accurately capturing key spatial dependency paths even when interface business scenarios change (such as adding new interfaces or sudden business activities). Furthermore, the graph attention computation process effectively filters out low-correlation neighbor noise, strengthens the transmission of high-value information, and makes the generated spatial correlation features more discriminative and robust. This provides high-quality feature support for subsequent generative correction and final traffic prediction, significantly improving prediction accuracy in multi-interface collaborative scenarios.
[0101] In one possible implementation, the basic model of the generative correction layer is a conditional diffusion model. S304, "by performing conditional correction on the long-term trend features and spatial correlation features of the target sample through the generative correction layer, the corrected features and confidence intervals of the target sample can be obtained," can be achieved through the following steps:
[0102] In the positive noise addition stage, Gaussian noise is gradually superimposed on the real flow rate of the target sample according to the diffusion time step to obtain the noise flow rate;
[0103] In the reverse denoising stage, the long-term trend features and spatial correlation features of the target sample are concatenated into global conditional features. The noise flow, diffusion time step and global conditional features are input into the denoising network of the conditional diffusion model to determine the diffusion loss value based on the predicted noise and Gaussian noise. The denoising network performs local reverse denoising on the global conditional features to obtain the corrected features and confidence interval of the target sample. The diffusion loss value is the basis for determining the loss function value.
[0104] In this embodiment, the forward noise addition stage is the fundamental process for the conditional diffusion model to learn the data distribution, transforming ordered real traffic data into random noise conforming to a standard normal distribution. The diffusion time step can refer to a preset time index sequence during the diffusion process, used to control the progress of noise addition. Gaussian noise can refer to normally distributed noise with a mean of 0 and a variance increasing with time steps; its function is to gradually destroy the structural information of the original data. Specifically, according to the order of the diffusion time steps, Gaussian noise is progressively added to the real traffic of the target sample, making the data state gradually approach a pure noise distribution. Through this progressive noise addition method, a complete mapping path from ordered data to disordered noise can be constructed, providing a clear optimization target for subsequent reverse denoising learning.
[0105] In the reverse denoising stage, global conditional features are key constraint information guiding the denoising network to recover effective signals from noise. They ensure that the generated traffic data conforms to business logic and spatiotemporal context. The long-term trend features and spatial correlation features of the target sample can be concatenated along the feature dimension to form global conditional features containing complete spatiotemporal context. Injecting these global conditional features as prior knowledge into the denoising network allows the model to reconstruct data from noise not only based on statistical laws but also strongly constrained by known temporal trends and spatial relationships, thereby avoiding the generation of false traffic data that does not conform to the actual business scenario.
[0106] The denoising network is a core component of the conditional diffusion model, typically employing U-Net or Transformer architectures. It learns the inverse process of recovering the original signal from noise under given conditions. Noise flow refers to the noisy data generated during the forward denoising stage. The diffusion time step provides information on the current denoising progress, and global conditional features provide spatiotemporal context constraints. After receiving these three types of inputs, the denoising network outputs a predicted value for the noise added in the current step, i.e., the predicted noise. The diffusion loss is a quantitative metric for measuring the model's denoising capability, obtained by calculating the mean square error between the predicted noise and the actual Gaussian noise added during the forward denoising stage. During training, the denoising network continuously adjusts its internal parameters to minimize this diffusion loss, thereby learning how to accurately separate the true signal from the noise.
[0107] In the final stage of inference or training, the trained denoising network is used to iteratively generate high-quality corrected features, starting from a purely noisy or noisy initial state and incorporating global conditional features. Corrected features refer to the interface traffic feature representation obtained after denoising, eliminating the influence of missing or anomalies in data. These features integrate long-term time-series trends and spatial correlation information, exhibiting higher robustness. Confidence intervals, on the other hand, are statistical quantities reflecting the range of uncertainty in the prediction results, used to quantify the reliability of the prediction.
[0108] This application employs a conditional diffusion model through a generative correction layer, achieving deep synergy between long-term trend features, spatial correlation features, and a generative denoising mechanism. By concatenating long-term trend features and spatial correlation features into global conditional features and using them as strong constraints input to the denoising network, the forward denoising and reverse denoising processes are no longer simply noise additions and subtractions, but are controlled by the spatiotemporal evolution of interface services. This conditional guidance mechanism ensures that even when real traffic data is missing or there is severe noise interference, the denoising network can still grow corrected features that conform to business logic from the noise space based on known temporal trends and spatial correlation information. Simultaneously, based on the probabilistic characteristics of the diffusion process, the model can naturally characterize the uncertainty of predictions and output confidence intervals, providing a quantitative basis for resource scheduling and risk warning.
[0109] S103, input the time-series traffic characteristics and interface spatial characteristics of the target interface into the traffic prediction model to obtain the predicted traffic of the target interface.
[0110] In this embodiment, the temporal traffic characteristics and spatial characteristics of the target interface are input into the traffic prediction model. The traffic prediction model first captures long-term trends and periodic patterns in the input sequence through a long-term feature extraction layer. Then, it aggregates the influence weights of neighboring interfaces through a spatial correlation feature extraction layer. Subsequently, a generative correction layer is used to conditionally correct for potential data gaps or distribution shifts. Finally, a fusion layer performs weighted summation, and the final predicted traffic value is obtained through mapping via an output layer. The resulting predicted traffic is not only a point estimate but also outputs a corresponding confidence interval based on the model's internal confidence assessment mechanism, intuitively reflecting the reliability of the prediction result. This achieves end-to-end inference from feature input to result output, enabling real-time response to platform resource scheduling, load balancing, and fault warning needs, significantly improving the accuracy and robustness of traffic prediction.
[0111] Based on the above description, the traffic prediction method provided in this application constructs a prediction mechanism that captures long-term trends, mines dynamic spatial correlations, and corrects generative data. This not only significantly reduces the error of long-term prediction but also enhances the adaptability to sudden traffic changes and cold start scenarios of new interfaces, thereby providing accurate and reliable decision-making basis for resource planning and stability assurance of the interface integration platform.
[0112] The above describes a traffic prediction method provided by an embodiment of this application. The following describes an apparatus for performing the above traffic prediction method.
[0113] See Figure 4 , Figure 4 This is a schematic diagram of a flow prediction device provided in an embodiment of this application. Figure 4 As shown in the figure, an embodiment of this application provides a traffic flow prediction device, comprising:
[0114] The model training module 401 is used to iteratively train the basic model to obtain a traffic prediction model by using the temporal traffic characteristics and interface spatial characteristics of the calibrated interface as training samples and aiming to make the predicted traffic of the training samples approach its true traffic.
[0115] The traffic prediction module 402 is used to obtain the time-series traffic characteristics and interface spatial characteristics of the target interface; retrieve the trained traffic prediction model; and input the time-series traffic characteristics and interface spatial characteristics of the target interface into the traffic prediction model to obtain the predicted traffic of the target interface.
[0116] In one possible implementation, the traffic prediction module 402, used to obtain the temporal traffic characteristics and interface spatial characteristics of the target interface, is specifically used for:
[0117] Obtain the call traffic data, interface space data, external impact data, and time period data of the target interface; construct the time-series traffic characteristics of the target interface based on the call traffic data, external impact data, and time period data; construct the interface space characteristics of the target interface based on the interface space data.
[0118] In one possible implementation, the base model includes a long temporal feature extraction layer, a spatial correlation feature extraction layer, a generative correction layer, a fusion layer, and an output layer.
[0119] In one possible implementation, the model training module 401 is specifically used for:
[0120] The training process involves selecting target samples from the training samples for this iteration; predicting the time-series flow characteristics of the target samples using a long-term feature extraction layer to obtain their long-term trend features; predicting the long-term trend features and interface spatial features of the target samples using a spatial correlation feature extraction layer to obtain their spatial correlation features; conditionally correcting the long-term trend features and spatial correlation features of the target samples using a generative correction layer to obtain their corrected features and confidence intervals; and fusing the long-term trend features, spatial correlation features, and corrected features of the target samples using a fusion layer to obtain their comprehensive features. The predicted flow of the target sample is obtained by predicting the comprehensive features of the target sample through the output layer, and the loss function value of this iteration training is calculated based on the predicted flow and the actual flow of the target sample. If the loss function value does not meet the convergence condition, the network parameters of the long-term feature extraction layer, spatial correlation feature extraction layer, generative correction layer and fusion layer are adjusted, and the step of selecting the target sample for this iteration training from the training samples is returned until the loss function value meets the convergence condition. The training ends, and the trained base model is used as the prediction model. The prediction model can simultaneously output the predicted flow and the confidence interval predicted by the generative correction layer.
[0121] In one possible implementation, the model training module 401, used to predict the long-term trend features and interface spatial features of the target sample through the spatial correlation feature extraction layer to obtain the spatial correlation features of the target sample, is specifically used for:
[0122] The spatial features of the target sample are used as the input of the graph structure, and the temporal trend features of the target sample are used as the input of the node attributes. The spatial correlation features of the target sample are obtained by graph attention calculation.
[0123] In one possible implementation, the base model of the generative correction layer is a conditional diffusion model, used to conditionally correct the long-term trend features and spatial correlation features of the target sample through the generative correction layer, obtaining the corrected features and confidence intervals of the target sample. The model training module 401 is specifically used for:
[0124] In the forward noise addition stage, Gaussian noise is gradually superimposed on the actual flow of the target sample according to the diffusion time step to obtain the noise flow. In the reverse denoising stage, the long-term trend features and spatial correlation features of the target sample are concatenated into global conditional features. The noise flow, diffusion time step and global conditional features are input into the denoising network of the conditional diffusion model to determine the diffusion loss value based on the predicted noise and Gaussian noise. The denoising network performs local reverse denoising on the global conditional features to obtain the corrected features and confidence interval of the target sample. The diffusion loss value is the basis for determining the loss function value.
[0125] It should be noted that the detailed functions of each module in the embodiments of this application can be found in the corresponding disclosures of the above-mentioned traffic prediction method embodiments, and will not be repeated here.
[0126] This application also provides an electronic device in its embodiments. See also... Figure 5 , Figure 5 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. The electronic device in this embodiment may include, but is not limited to, fixed terminals such as mobile phones, laptops, PDAs (personal digital assistants), PADs (tablet computers), desktop computers, etc. Figure 5 The electronic device shown is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments of this application.
[0127] like Figure 5 As shown, the electronic device may include a processing unit (e.g., a central processing unit, a graphics processing unit, etc.) 501, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 502 or a program loaded from a storage device 508 into a random access memory (RAM) 503. When the electronic device is powered on, the RAM 503 also stores various programs and data required for the operation of the electronic device. The processing unit 501, ROM 502, and RAM 503 are interconnected via a bus 504. An input / output (I / O) interface 505 is also connected to the bus 504.
[0128] Typically, the following devices can be connected to I / O interface 505: input devices 506 including, for example, touchscreens, touchpads, keyboards, mice, cameras, microphones, accelerometers, gyroscopes, etc.; output devices 507 including, for example, liquid crystal displays (LCDs), speakers, vibrators, etc.; storage devices 508 including, for example, memory cards, hard drives, etc.; and communication devices 509. Communication device 509 allows electronic devices to communicate wirelessly or wiredly with other devices to exchange data. Although Figure 5 Electronic devices with various devices are shown, but it should be understood that it is not required to implement or have all of the devices shown. More or fewer devices may be implemented or have alternatively.
[0129] This application also provides a computer program product including computer-readable instructions, which, when executed on an electronic device, cause the electronic device to implement any of the traffic prediction methods provided in this application.
[0130] This application also provides a computer-readable storage medium carrying one or more computer programs. When the one or more computer programs are executed by an electronic device, the electronic device can implement any of the traffic prediction methods provided in this application.
[0131] It should also be noted that the device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. In addition, in the device embodiment drawings provided in this application, the connection relationship between modules indicates that they have a communication connection, which can be implemented as one or more communication buses or signal lines.
[0132] Through the above description of the embodiments, those skilled in the art can clearly understand that this application can be implemented by means of software plus necessary general-purpose hardware, or it can be implemented by special-purpose hardware including application-specific integrated circuits, special-purpose CPUs, special-purpose memory, special-purpose components, etc. Generally, any function performed by a computer program can be easily implemented by corresponding hardware, and the specific hardware structure used to implement the same function can also be diverse, such as analog circuits, digital circuits, or special-purpose circuits. However, for this application, software program implementation is more often the preferred implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a readable storage medium, such as a computer floppy disk, USB flash drive, mobile hard disk, ROM, RAM, magnetic disk, or optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, training equipment, or network device, etc.) to execute the methods described in the various embodiments of this application.
[0133] In the above embodiments, the implementation can be achieved, in whole or in part, through software, hardware, firmware, or any combination thereof. When implemented in software, it can be implemented, in whole or in part, in the form of a computer program product.
[0134] The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of this application are generated. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions may be transmitted from one website, computer, training device, or data center to another website, computer, training device, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium may be any available medium that a computer can store or a data storage device such as a training device or data center that integrates one or more available media. The available media may be magnetic media (e.g., floppy disks, hard disks, magnetic tapes), optical media (e.g., DVDs), or semiconductor media (e.g., solid-state drives (SSDs)).
Claims
1. A flow prediction method, characterized in that, The traffic prediction method includes: Obtain the time-series traffic characteristics and interface space characteristics of the target interface; The trained traffic prediction model is retrieved. The traffic prediction model is obtained by iteratively training the basic model with the time-series traffic characteristics and interface spatial characteristics of the calibrated interface as training samples and with the goal of making the predicted traffic of the training samples approach its actual traffic. The time-series traffic characteristics and interface spatial characteristics of the target interface are input into the traffic prediction model to obtain the predicted traffic of the target interface.
2. The flow prediction method according to claim 1, characterized in that, The acquisition of the time-series traffic characteristics and interface space characteristics of the target interface includes: Obtain the call traffic data, interface space data, external impact data, and time period data of the target interface; The time-series traffic characteristics of the target interface are constructed based on the call traffic data, the external influence data, and the time period data. The interface space features of the target interface are constructed based on the interface space data.
3. The flow prediction method according to claim 1, characterized in that, The basic model includes a long-term feature extraction layer, a spatial correlation feature extraction layer, a generative correction layer, a fusion layer, and an output layer.
4. The flow prediction method according to claim 3, characterized in that, The process of obtaining the traffic prediction model by iteratively training a basic model using the temporal traffic characteristics and interface spatial characteristics of a calibrated interface as training samples, with the goal of making the predicted traffic of the training samples approximate its actual traffic, includes: Select target samples for this iteration of training from the training samples; The long-term time-series feature extraction layer is used to predict the time-series flow characteristics of the target sample to obtain the long-term time-series trend characteristics of the target sample. The spatial correlation feature extraction layer is used to predict the long-term trend features and interface spatial features of the target sample to obtain the spatial correlation features of the target sample. The generative correction layer is used to conditionally correct the long-term trend features and spatial correlation features of the target sample, thereby obtaining the corrected features and confidence intervals of the target sample. The fusion layer fuses the long-term trend features, spatial correlation features, and modified features of the target sample to obtain the comprehensive features of the target sample. The predicted flow of the target sample is obtained by predicting the comprehensive features of the target sample through the output layer, and the loss function value of this iteration training is calculated based on the predicted flow and the actual flow of the target sample. If the loss function value does not meet the convergence condition, the network parameters of the long-term feature extraction layer, the spatial correlation feature extraction layer, the generative correction layer, and the fusion layer are adjusted, and the step of selecting target samples from the training samples for this iteration of training is returned until the loss function value meets the convergence condition. Then the training ends, and the trained base model is used as the prediction model. The prediction model can simultaneously output the predicted flow and the confidence interval predicted by the generative correction layer.
5. The flow prediction method according to claim 4, characterized in that, The step of predicting the long-term trend features and interface spatial features of the target sample through the spatial correlation feature extraction layer to obtain the spatial correlation features of the target sample includes: The spatial features of the target sample are used as the input of the graph structure, and the temporal trend features of the target sample are used as the input of the node attributes. The spatial association features of the target sample are obtained by graph attention calculation.
6. The flow prediction method according to claim 4, characterized in that, The generative correction layer is based on a conditional diffusion model. The generative correction layer conditions the long-term trend features and spatial correlation features of the target sample to obtain the corrected features and confidence intervals of the target sample, including: During the positive noise addition stage, Gaussian noise is gradually superimposed on the actual flow rate of the target sample according to the diffusion time step to obtain the noise flow rate; In the reverse denoising stage, the long-term trend features and spatial correlation features of the target sample are concatenated into global conditional features; the noise flow, the diffusion time step, and the global conditional features are input into the denoising network of the conditional diffusion model to determine the diffusion loss value based on the predicted noise and the Gaussian noise; the denoising network performs local reverse denoising on the global conditional features to obtain the corrected features and confidence interval of the target sample, and the diffusion loss value is the basis for determining the loss function value.
7. A flow prediction device, characterized in that, The flow prediction device includes: The model training module is used to iteratively train the basic model to obtain a traffic prediction model by using the temporal traffic characteristics and interface spatial characteristics of the calibrated interface as training samples and aiming to make the predicted traffic of the training samples approach its actual traffic. The traffic prediction module is used to acquire the time-series traffic characteristics and interface spatial characteristics of the target interface; retrieve the trained traffic prediction model; and input the time-series traffic characteristics and interface spatial characteristics of the target interface into the traffic prediction model to obtain the predicted traffic of the target interface.
8. A computer program product, characterized in that, Includes computer-readable instructions that, when executed on an electronic device, cause the electronic device to implement the traffic prediction method as described in any one of claims 1 to 6.
9. An electronic device, characterized in that, It includes at least one processor and a memory connected to the processor, wherein: The memory is used to store computer programs; The processor is used to execute the computer program to enable the electronic device to implement the traffic prediction method as described in any one of claims 1 to 6.
10. A computer storage medium, characterized in that, The storage medium carries one or more computer programs that, when executed by an electronic device, enable the electronic device to implement the traffic prediction method as described in any one of claims 1 to 6.