Resource usage amount prediction method and electronic equipment
By extracting, coding, abnormal detection and weighting parameters during the development of computer and network products, the problem of inaccurate prediction of resource usage in the existing technology is solved, and higher prediction accuracy and resource investment control are achieved.
Patent Information
- Application Number
- CN202411500165.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-25
- Publication Date
- 2025-02-07
AI Technical Summary
The prior art is difficult to accurately predict the amount of resource usage in the research and development of computer and network products, resulting in inaccurate resource investment and difficult to form standard reusable prediction solutions.
By extracting the predicted object parameters, encoding processing generates feature sequences, performing exception detection and weighting processing, and finally decoding the predicted value of resource usage.
It improves the accuracy of resource usage prediction, reduces the impact of abnormal characteristic values on prediction, and achieves more accurate resource investment control.
Smart Images

Figure CN119397444A_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the field of computer and network technology, and specifically relates to a resource usage prediction method and an electronic device. Background Art
[0002] Product development in the field of computer and network technology usually includes two parts: hardware development and software development. During the product development process, it is generally necessary to predict the resource usage of each process link in the development process in order to accurately control the development progress and resource investment.
[0003] The development process of computer and network products is complex and changeable. The resource usage is affected by multiple variables such as product scale, design parameters, historical experience, etc., and usually presents nonlinear changes. Traditional resource usage forecasting methods rely on expert experience, which is not only difficult to implement and requires large resource investment, but also difficult to form a set of standard and reusable forecasting solutions. Summary of the invention
[0004] The present application provides a resource usage prediction method and electronic device, aiming to improve the prediction accuracy of resource usage of computers and network products.
[0005] According to one aspect of an embodiment of the present application, a method for predicting resource usage is provided, comprising: extracting parameters of a prediction object to obtain attribute parameters correlated with the resource usage of the prediction object; encoding the attribute parameters to obtain a feature sequence of the prediction object, the feature sequence comprising multiple feature values; performing anomaly detection on the feature values in the feature sequence to obtain normal feature values and abnormal feature values; weighting the abnormal feature values according to the normal feature values to obtain corrected feature values; decoding the feature sequence including the normal feature values and the corrected feature values to obtain a predicted value of the resource usage of the prediction object.
[0006] According to one aspect of an embodiment of the present application, a resource usage prediction device is provided, including:
[0007] An extraction module is configured to extract parameters of the prediction object to obtain attribute parameters that are correlated with the resource usage of the prediction object;
[0008] An encoding module, configured to perform encoding processing on the attribute parameters to obtain a feature sequence of the predicted object, wherein the feature sequence includes a plurality of feature values;
[0009] A detection module is configured to perform anomaly detection on the feature values in the feature sequence to obtain normal feature values and abnormal feature values;
[0010] A weighting module, configured to perform weighted processing on the abnormal feature value according to the normal feature value to obtain a modified feature value;
[0011] The decoding module is configured to decode the feature sequence including the normal feature value and the modified feature value to obtain the predicted value of the resource usage of the predicted object.
[0012] In some embodiments of the present application, based on the above technical solution, the detection module further includes:
[0013] An acquisition module is configured to acquire a relative entropy between the attention probability distribution and the uniform distribution of the feature sequence, wherein the relative entropy is used to represent a degree of difference between the attention probability distribution and the uniform distribution;
[0014] A prediction module, configured to select feature values far from the uniform distribution from the feature sequence according to the relative entropy, and predict a probability distribution model of the feature values;
[0015] A first determining module is configured to determine the characteristic value as a normal characteristic value when the probability distribution model is a first preset model;
[0016] The second determination module is configured to determine the characteristic value as an abnormal characteristic value when the probability distribution model is a second preset model.
[0017] In some embodiments of the present application, based on the above technical solution, the first preset model is an exponential distribution model, and the second preset model is an inverse Gaussian distribution model.
[0018] In some embodiments of the present application, based on the above technical solution, the prediction module further includes:
[0019] A historical data acquisition module is configured to respectively acquire historical data corresponding to each of the characteristic values;
[0020] A probability prediction module, configured to predict the probability that the characteristic value obeys the exponential distribution model and the inverse Gaussian distribution model respectively according to the historical data;
[0021] The model determination module is configured to determine the model with a larger probability between the exponential distribution model and the inverse Gaussian distribution model as the probability distribution model of the eigenvalue.
[0022] In some embodiments of the present application, based on the above technical solution, the weighting module further includes:
[0023] A threshold determination module, configured to determine a screening threshold of an abnormal feature value according to the normal feature value;
[0024] a feature value assignment module, configured to assign the abnormal feature value to zero if the absolute value of the abnormal feature value is greater than the screening threshold;
[0025] The feature value weighting module is configured to perform weighted processing on the abnormal feature value according to a preset weighting coefficient if the absolute value of the abnormal feature value is less than the screening threshold.
[0026] In some embodiments of the present application, based on the above technical solution, the threshold determination module is further configured to: calculate the median of the absolute value of the normal feature value; and determine a specified multiple of the median as a screening threshold for abnormal feature values.
[0027] In some embodiments of the present application, based on the above technical solution, the resource usage prediction device further includes:
[0028] an error determination module, configured to determine a loss error and a change trend error of the resource usage according to the predicted value of the resource usage of the prediction object, wherein the loss error is used to represent the error between the predicted value and the true value of the resource usage, and the change trend prediction error is used to represent whether the predicted value and the true value of the resource usage have the same change trend;
[0029] an error weighting module, configured to perform weighted processing on the loss error according to the change trend error to obtain a corrected error;
[0030] The parameter updating module is configured to update the model parameters used for encoding and decoding processing according to the corrected error.
[0031] In some embodiments of the present application, based on the above technical solution, the error determination module is further configured to: obtain the difference between the predicted value of the resource usage of the predicted object and the actual value of the resource usage at the historical moment, and obtain the predicted value change; obtain the difference between the actual value of the resource usage of the predicted object and the actual value of the resource usage at the historical moment, and obtain the actual value change; determine the change trend error of the resource usage based on the product of the predicted value change and the actual value change.
[0032] In some embodiments of the present application, based on the above technical solution, the error weighting module is further configured as follows: if the change trend error is less than zero, the loss error is weighted according to a preset penalty coefficient, and the penalty coefficient is greater than zero.
[0033] According to one aspect of an embodiment of the present application, a computer-readable medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the method for predicting resource usage in the above technical solution is implemented.
[0034] According to one aspect of an embodiment of the present application, an electronic device is provided, comprising: a processor; and a memory for storing executable instructions of the processor; wherein the processor is configured to execute the executable instructions to implement a method for predicting resource usage as in the above technical solution.
[0035] According to one aspect of an embodiment of the present application, a computer program product is provided, including a computer program, and when the computer program is executed by a processor, the method for predicting resource usage in the above technical solution is implemented.
[0036] In the technical solution provided by the embodiment of the present application, firstly, the parameters of the predicted object are extracted to obtain the attribute parameters that are correlated with the resource usage of the predicted object, then the attribute parameters are encoded to obtain the feature sequence of the predicted object, the feature values in the feature sequence are detected for abnormality to obtain normal feature values and abnormal feature values, the abnormal feature values are weighted according to the normal feature values to obtain the corrected feature values, and finally the feature sequence containing the normal feature values and the corrected feature values is decoded to obtain the predicted value of the resource usage of the predicted object. The embodiment of the present application can reduce the influence of the abnormal feature values on the resource usage prediction by weighting and correcting the abnormal feature values, thereby improving the accuracy of the resource usage prediction.
[0037] It should be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] The drawings herein are incorporated into the specification and constitute a part of the specification, illustrate embodiments consistent with the present application, and together with the specification are used to explain the principles of the present application. Obviously, the drawings described below are only some embodiments of the present application, and for ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0039] Figure 1 The exemplary system architecture block diagram applying the technical solution of the present application is schematically shown.
[0040] Figure 2 A flow chart of a method for predicting resource usage in one embodiment of the present application is shown.
[0041] Figure 3 The figure shows the model structure of the encoder used in one embodiment of the present application.
[0042] Figure 4 The numerical distribution of KL divergence calculated based on the feature sequence in the embodiment of the present application is shown.
[0043] Figure 5 The figure shows the model structure of the decoder used in one embodiment of the present application.
[0044] Figure 6 The structural block diagram of the resource usage prediction device provided in an embodiment of the present application is schematically shown.
[0045] Figure 7 The structure block diagram of a computer system suitable for implementing an electronic device according to an embodiment of the present application is schematically shown. DETAILED DESCRIPTION
[0046] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be implemented in a variety of forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that this application will be more comprehensive and complete and fully convey the concept of the example embodiments to those skilled in the art.
[0047] In addition, described feature, structure or characteristic can be combined in one or more embodiments in any suitable manner. In the following description, many specific details are provided to provide a full understanding of the embodiments of the present application. However, those skilled in the art will appreciate that the technical scheme of the present application can be put into practice without one or more of the specific details, or other methods, components, devices, steps, etc. can be adopted. In other cases, known methods, devices, realizations or operations are not shown or described in detail to avoid blurring the various aspects of the application.
[0048] In the embodiments of the present application, the term "module" or "unit" refers to a computer program or a part of a computer program with a predetermined function, and works together with other related parts to achieve a predetermined goal, and can be implemented in whole or in part by using software, hardware (such as processing circuits or memories) or a combination thereof. Similarly, a processor (or multiple processors or memories) can be used to implement one or more modules or units. In addition, each module or unit can be part of an overall module or unit that includes the function of the module or unit.
[0049] The block diagrams shown in the accompanying drawings are merely functional entities and do not necessarily correspond to physically independent entities. That is, these functional entities may be implemented in software form, or in one or more hardware modules or integrated circuits, or in different networks and / or processor devices and / or microcontroller devices.
[0050] The flowcharts shown in the accompanying drawings are only exemplary and do not necessarily include all the contents and operations / steps, nor must they be executed in the order described. For example, some operations / steps can be decomposed, and some operations / steps can be combined or partially combined, so the actual execution order may change according to actual conditions.
[0051] Figure 1 The exemplary system architecture block diagram applying the technical solution of the present application is schematically shown.
[0052] like Figure 1 As shown, the system architecture 100 may include a terminal device 110, a network 120 and a server 130. The terminal device 110 may include various electronic devices such as smart phones, tablet computers, laptops, desktop computers, smart speakers, smart wearable devices, smart vehicle-mounted devices, and smart payment terminals. The server 130 may be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms. The network 120 may be a communication medium of various connection types that can provide a communication link between the terminal device 110 and the server 130, such as a wired communication link or a wireless communication link.
[0053] According to the implementation requirements, the system architecture in the embodiment of the present application can have any number of terminal devices, networks and servers. For example, the server 130 can be a server group composed of multiple server devices. In addition, the technical solution provided in the embodiment of the present application can be applied to the terminal device 110, can also be applied to the server 130, or can be implemented by the terminal device 110 and the server 130 together, and the present application does not make any special restrictions on this.
[0054] The following is a detailed description of the technical solutions such as the resource usage prediction method, resource usage prediction device, computer-readable medium, electronic device, and computer program product provided in the present application in combination with specific implementation methods.
[0055] Figure 2 A flowchart showing a method for predicting resource usage in an embodiment of the present application is shown. The method for predicting resource usage can be performed by Figure 1 The method is executed by the terminal device or the server shown, or can be executed by the terminal device and the server together. The embodiment of the present application takes the resource usage prediction method executed by the terminal device as an example.
[0056] like Figure 2As shown, the resource usage prediction method in the embodiment of the present application may include the following steps S210 to S250.
[0057] S210: Extract parameters of the prediction object to obtain attribute parameters that are correlated with the resource usage of the prediction object.
[0058] S220: Encode the attribute parameters to obtain a feature sequence of the prediction object, where the feature sequence includes multiple feature values.
[0059] S230: Perform anomaly detection on the feature values in the feature sequence to obtain normal feature values and abnormal feature values.
[0060] S240: Perform weighted processing on the abnormal eigenvalues according to the normal eigenvalues to obtain corrected eigenvalues.
[0061] S250: Decode the feature sequence including the normal feature value and the modified feature value to obtain a predicted value of the resource usage of the prediction object.
[0062] In the resource usage prediction method provided in the embodiment of the present application, by performing weighted correction on abnormal characteristic values, the influence of abnormal characteristic values on resource usage prediction can be reduced, thereby improving the accuracy of resource usage prediction.
[0063] The following describes in detail the various steps in the resource usage prediction method in conjunction with a plurality of embodiments.
[0064] In step S210, parameters are extracted from the prediction object to obtain attribute parameters that are correlated with the resource usage of the prediction object.
[0065] The forecast objects may include product development projects in the field of computer and network technology, such as hardware product development projects and software product development projects. Resource usage may include the input usage of various resource types such as computing resources, storage resources, and network resources.
[0066] Hardware product development usually includes multiple R&D stages, including market research, concept design, detailed design, prototyping, testing and verification, design optimization, small-batch trial production, and mass production. Among them, market research is used to understand market demand, competitor conditions, and potential user preferences; concept design is to determine the product's functions, performance indicators, and preliminary design based on market research results; detailed design includes circuit design, PCB layout, component selection, thermal design, industrial design, etc.; prototyping is used to make prototypes according to design drawings for preliminary testing and verification; testing and verification are used to perform various tests on prototypes, including functional testing, performance testing, safety testing, reliability testing, etc.; design optimization is used to optimize the design based on test results to solve problems found; small-batch trial production is to conduct small-batch production after optimizing the design to further verify the manufacturability and quality of the product. Mass production is to start large-scale production after confirming that the product has no major problems.
[0067] Software product development usually follows multiple R&D processes including demand analysis, system design, coding, testing, deployment, maintenance, and iterative development. The demand analysis phase is used to collect and analyze user needs and clarify product functions and performance requirements; the system design phase is used to design the software architecture, interface, database model, etc.; the coding phase is used to write code according to the design documents; the testing phase is used to perform unit testing, integration testing, system testing, and acceptance testing on the software; the deployment phase is used to deploy the software to the production environment; the maintenance phase is used to fix software defects, update functions, and improve performance; the iterative development phase is used to continuously iterate and improve the product based on user feedback and market changes.
[0068] For each process link of the product development project, attribute parameters that are correlated with resource usage can be extracted. In one embodiment of the present application, the Pearson Correlation Coefficient can be used to calculate the correlation between the extracted attribute parameters and resource usage, and attribute parameters with a high degree of correlation can be selected.
[0069] The Pearson correlation coefficient, also known as the Pearson product-moment correlation coefficient, is a statistic used to measure the degree of linear correlation between two variables. Its value is between -1 and 1, where: 1 means that there is a perfect positive linear correlation between the two variables, that is, an increase in one variable is accompanied by an increase in the other variable; -1 means that there is a perfect negative linear correlation between the two variables, that is, an increase in one variable is accompanied by a decrease in the other variable; 0 means that there is no linear correlation between the two variables.
[0070] In one embodiment of the present application, the attribute parameters correlated with resource usage may include one or more parameters of function points, function complexity, system concurrency, and historical experience coefficient.
[0071] Function points are used to quantify the size and complexity of product development projects. It evaluates the workload and cost of a project by counting the function points in the product (such as input, output, query, file, etc.). The calculation of function points involves a detailed analysis of product requirements, including internal logic files (ILF), external interface files (EIF), external inputs (EI), external outputs (EO), and external queries (EQ). Through these counting units, the total number of function points of a product development project can be estimated, which can then be used for project planning and cost estimation. The function point calculation method helps to measure scale in the early stages of a project and is independent of the language and technology of the project.
[0072] Functional complexity refers to the complexity of product functions in the implementation process. It involves the difficulty of implementing the function, the technical depth required, and the challenges that may be encountered. The evaluation of functional complexity usually needs to consider factors such as the interactivity of the function, the degree of componentization, cross-system interaction, and whether hardcore technology is required. Highly complex functions may require more development time and resources, so special considerations are required during project planning and resource allocation.
[0073] System concurrency refers to the number of requests or transactions that a product system can handle at the same time. It is an important indicator for measuring product performance and directly affects user experience and product system stability. The evaluation of system concurrency usually involves parameters such as QPS (query per second), TPS (transactions per second), response time, and system resource utilization. High-concurrency systems require optimization of database access, network communication, and server processing capabilities to ensure good performance under high load.
[0074] The historical experience factor is a method for estimating project workload and resource usage based on historical data and experience. In the absence of precise measurement data, the historical experience factor can provide a reference to help estimate the time and resources required to complete a specific feature or project. This method usually relies on historical data of similar projects, including the amount of work completed, challenges encountered, and actual time spent. The accuracy of the historical experience factor depends on the quality and relevance of the historical data.
[0075] In step S220, the attribute parameters are encoded to obtain a feature sequence of the prediction object, where the feature sequence includes a plurality of feature values.
[0076] In one embodiment of the present application, the attribute parameters are input into a pre-trained encoder, and the attribute parameters are encoded by the encoder to obtain a feature sequence of the predicted object.
[0077] Figure 3 The model structure of the encoder used in one embodiment of the present application is shown. Figure 3As shown in the figure, the encoder uses a multi-head probabilistic sparse self-attention mechanism to focus on the relevance of the main contribution points. The encoder receives the input attribute parameters, uses the probabilistic sparse self-attention mechanism to selectively calculate the attention between the query and the key, and then uses the self-attention distillation extraction model to extract the information with dominant features in each layer, and then reduces the time dimension through maximum pooling and 1-D convolution, and finally concatenates the output feature maps of all layers as output.
[0078] In step S230, abnormality detection is performed on the feature values in the feature sequence to obtain normal feature values and abnormal feature values.
[0079] In one embodiment of the present application, a method for performing anomaly detection on feature values in a feature sequence may include: obtaining a relative entropy between an attention probability distribution and a uniform distribution of the feature sequence, the relative entropy being used to indicate the degree of difference between the attention probability distribution and the uniform distribution; screening feature values that are far from the uniform distribution from the feature sequence according to the relative entropy, and predicting a probability distribution model of the feature values; when the probability distribution model is a first preset model, determining the feature value as a normal feature value; and when the probability distribution model is a second preset model, determining the feature value as an abnormal feature value.
[0080] In one embodiment of the present application, the relative entropy between the attention probability distribution and the uniform distribution can be represented by KL divergence. KL divergence, also known as Kullback-Leibler divergence, is a measure of the difference between two probability distributions. It originates from information theory and is used to describe the asymmetric difference of one probability distribution relative to another probability distribution.
[0081] The KL divergence in the embodiment of the present application can be calculated based on the following formula.
[0082]
[0083] Among them, p represents the attention probability distribution, q represents the uniform distribution, Lk represents the sequence length, and d represents the dimension of the data sequence after mapping. qi and kj represent the query vector Query and the key vector Key respectively.
[0084] Figure 4 The numerical distribution of the KL divergence calculated based on the feature sequence in the embodiment of the present application is shown. The data points at the bottom obey the uniform distribution and are therefore identified as redundant points. The data points at the top are far from the uniform distribution and can be identified as abnormal points or contribution points.
[0085] The probability sparse distribution obeys the characteristics of the long tail effect, that is, there will be contribution points and redundant points in the query, and the calculation task will be reduced by ignoring the redundant points during the model training process. The probability sparse attention mechanism will regard the outliers as the main contribution points during the calculation process, which directly affects the prediction accuracy of the model. Therefore, the embodiment of the present application performs anomaly detection on the contribution points far from the uniform distribution through the prediction of the probability distribution model, and identifies the normal feature values and abnormal feature values.
[0086] In one embodiment of the present application, the first preset model is an exponential distribution model, and the second preset model is an inverse Gaussian distribution model. A key feature of the inverse Gaussian distribution is that its mean can grow linearly over time, so it is suitable for application in the resource usage prediction process that changes over time.
[0087] The function of the inverse Gaussian distribution model is as follows.
[0088]
[0089] The function of the exponential distribution model is as follows.
[0090] f c (x) = τ e exp(-τ e x)μ(x)
[0091] Among them, τ and μ are adjustable parameters, and t is the time interval, which represents the time for two random variables to reach the inverse Gaussian distribution.
[0092] The method for predicting the probability distribution model of a eigenvalue may include: respectively acquiring historical data corresponding to each eigenvalue; respectively predicting the probability that the eigenvalue obeys an exponential distribution model and an inverse Gaussian distribution model based on the historical data; and determining the model with a larger probability between the exponential distribution model and the inverse Gaussian distribution model as the probability distribution model of the eigenvalue.
[0093] The embodiment of the present application enhances the adaptability of the software cost prediction task by constructing an outlier recognition module in the probabilistic sparse attention mechanism. The key contribution points screened by KL divergence are input into the anomaly recognition module. The module establishes two hypotheses, H0 anomaly and H1 non-anomaly, for the key points at the current moment. Based on the Bayesian framework, the prior probability and the posterior probability of historical data are used to calculate the probability of each hypothesis being true. Finally, the outliers are automatically distinguished through the probability distribution results.
[0094] The prior probability is defined in the embodiment of the present application as: a composite inverse Gaussian distribution for non-outliers and a composite exponential distribution for outliers. At the same time, the likelihood function is defined according to the following formula.
[0095] p(r n |H i , r:n)=f c(μ n , τ n |γθ n )
[0096] f c (τ, μ|a, b, c, d) ∝ λ d exp(-λ(aμ -2 -bμ -1 +c))
[0097] Among them, θ n ={a n , b n , c n , d n} are attribute parameters, such as function points, function complexity, system concurrency and historical experience coefficient; r:n is the historical data set, and γ is a coefficient greater than 0 and less than 1.
[0098] Based on the prior probability and likelihood function, Bayes' theorem can be used to calculate the posterior probability of the two hypotheses according to the following formula.
[0099]
[0100] Here, the denominator is the sum of the likelihood probabilities under all hypotheses, which serves as a normalization factor.
[0101] Based on the posterior probability, the probability that the hypothesis is valid under the new observation data can be calculated according to the following formula.
[0102]
[0103] Anomalies can be identified based on the probability. If H0 is high, it indicates that the current observation is an anomaly, whereas if H1 is high, it indicates that the observation is a non-abnormal contribution point.
[0104] In step S240, the abnormal eigenvalues are weighted according to the normal eigenvalues to obtain the corrected eigenvalues.
[0105] In one embodiment of the present application, a method for weighted processing of abnormal feature values according to normal feature values may include: determining a screening threshold of abnormal feature values according to normal feature values; if the absolute value of the abnormal feature value is greater than the screening threshold, assigning the abnormal feature value to zero; if the absolute value of the abnormal feature value is less than the screening threshold, weighted processing of the abnormal feature value according to a preset weighting coefficient.
[0106] In one embodiment of the present application, a method for determining a screening threshold of an abnormal feature value based on a normal feature value may include: calculating the median of the absolute value of the normal feature value; and determining a specified multiple of the median as the screening threshold of the abnormal feature value.
[0107] For example, the embodiment of the present application can calculate the median value n by the absolute value of the non-abnormal contribution point according to the following formula, and set twice the median value 2n as the threshold. When the absolute value of the abnormal point is within the threshold 2n range, the abnormal point will use the weighting coefficient to reduce the weight of the abnormal point; when the absolute value of the abnormal point is outside the threshold 2n range, the abnormal point will be filtered by 0.
[0108]
[0109] Among them, dot is the abnormal point, n is the median of the contribution points, and ω is the weighting coefficient with a value of 0-1.
[0110] In step S250, the feature sequence including the normal feature value and the modified feature value is decoded to obtain a predicted value of the resource usage of the prediction object.
[0111] Figure 5 The model structure of the decoder used in one embodiment of the present application is shown. Figure 5 As shown in the figure, the decoder receives a target placeholder sequence filled with 0, extracts the target sequence features through the probabilistic sparse self-attention mechanism, and uses a mask operation to prevent the decoder from seeing future sequence values when generating predictions. The feature sequence and target sequence output by the encoder are then loaded into the multi-head attention mechanism to process information in multiple subspaces in parallel. Finally, the generative decoder generates a prediction sequence through forward propagation to replace the placeholders filled with 0, and finally outputs the predicted value of the resource usage of the predicted object through the fully connected layer.
[0112] In one embodiment of the present application, after decoding the feature sequence including normal feature values and corrected feature values, it also includes the step of updating the model parameters of the encoder and decoder: determining the loss error and change trend error of the resource usage according to the predicted value of the resource usage of the predicted object, the loss error is used to represent the error between the predicted value and the true value of the resource usage, and the change trend prediction error is used to indicate whether the predicted value and the true value of the resource usage have the same change trend; weighting the loss error according to the change trend error to obtain the corrected error; and updating the model parameters used for encoding and decoding according to the corrected error.
[0113] In one embodiment of the present application, a method for determining a changing trend error of resource usage based on a predicted value of resource usage of a predicted object may include: obtaining the difference between the predicted value of resource usage of the predicted object and the actual value of resource usage at a historical moment to obtain a predicted value change; obtaining the difference between the actual value of resource usage of the predicted object and the actual value of resource usage at a historical moment to obtain a actual value change; and determining a changing trend error of resource usage based on the product of the predicted value change and the actual value change.
[0114] In one embodiment of the present application, the method of weighting the loss error according to the change trend error may include: if the change trend error is less than zero, weighting the loss error according to a preset penalty coefficient, and the penalty coefficient is greater than zero.
[0115] For example, the embodiment of the present application can perform weighted processing on the loss error according to the following formula.
[0116]
[0117] Among them, V t is the actual value of resource usage at time t, V t+1 is the actual value of resource usage at time t+1, is the predicted value of resource usage at time t+1.
[0118] In the embodiment of the present application, when the predicted value of resource usage has the same change trend as the true value, the mean square error of the predicted value and the true value is used as the loss function to make the predicted value of resource usage fit to the true value according to the same trend. In addition, when the predicted value of resource usage has the opposite change trend to the true value, a penalty coefficient is introduced to increase the loss value so that the model can further adjust the prediction direction during the training process.
[0119] In an application scenario, the embodiment of the present application may first clean the historical data and construct a model training data set. Then, the data is loaded into the model proposed in the embodiment of the present application for training to obtain the optimal model. Finally, the attribute parameters of the product development project are loaded into the optimal model to predict the resource usage of the product development project. The prediction process may specifically include the following steps.
[0120] Step 101: Count the design parameters and R&D resource usage data of the product R&D project through the historical database.
[0121] Step 102: Clean and process historical data.
[0122] Step 103: Use the Pearson coefficient to calculate the correlation between the attribute parameters of the product development project and the resource usage, and extract the software function points, function complexity, system concurrency, and historical experience coefficient as attribute parameters.
[0123] Step 104: construct a data set using the attribute parameters and resource usage of the historical data.
[0124] Step 105: Use normalization to map the data into a data distribution with a mean of 0 and a variance of 1.
[0125] Step 106: Load the data into the improved model.
[0126] Step 201: The model receives input data.
[0127] Step 202: The model Encoder loads 96 training labels and assigns order information to the input sequence through position encoding.
[0128] Step 203, the model encoder loads the training labels with positional encoding into the probabilistic sparse attention mechanism, converts the sequence into query (Q), key (K) and value (V) through a linear layer. Then, a probability distribution is generated for the query (Q) vector, which reflects the attention weight of each query (Q) vector to other key (K) vectors.
[0129] Step 204: The probability sparse attention mechanism of the model Encoder selects the query (Q) vector far from the uniform distribution as the contribution point based on the probability distribution of the query (Q) vector obtained in step 203 and the KL divergence calculation.
[0130] Step 205: The probabilistic sparse attention mechanism of the model encoder loads the query (Q) vector obtained in step 204 into the outlier identification module. The module establishes two hypotheses, H0 abnormal and H1 non-abnormal, for the contribution points at the current moment, and calculates the probability of each hypothesis being true based on the prior probability and historical data based on the Bayesian framework. Finally, the outliers are automatically distinguished based on the probability distribution results.
[0131] Step 206: The probabilistic sparse attention mechanism of the model encoder loads the outliers obtained in step 205 into the outlier filtering module, calculates the median value n by the absolute value of the contribution point, and sets twice the median value 2n as the threshold. The identified outliers are input into the filtering module. When the absolute value of the outlier is within the threshold 2n range, the outlier will use ω (0-1) to reduce the weight of the outlier; when the absolute value of the outlier is outside the threshold 2n range, the outlier will be filtered using 0.
[0132] Step 207, the probabilistic sparse attention mechanism of the model Encoder encoder takes the contribution points selected in step 204 and the outliers filtered in step 206 as sampling points, then multiplies their key vectors with the value vectors, and performs weighted summation according to the probability distribution to obtain the final attention value.
[0133] Step 208, the self-attention distillation structure extraction model of the model Encoder extracts information with dominant features in each layer, then reduces the time dimension through maximum pooling and 1-D convolution, and finally concatenates the output feature maps of all layers as output.
[0134] Step 209: The model Decoder receives the target placeholder sequence filled with 0s and gives order information to the input sequence through position encoding.
[0135] Step 210, the model Decoder uses the sequence probability sparse attention mechanism to extract the target sequence features and adopts a mask operation to prevent the decoder from seeing future sequence values when generating predictions.
[0136] Step 211, the multi-head attention mechanism of the model Decoder receives the feature map output by the encoder 208 and the target sequence features output by the decoder 210.
[0137] Step 212, the multi-head attention mechanism of the model Decoder processes the information of multiple subspaces in parallel, and finally the generative decoder generates a prediction sequence through forward propagation to replace the placeholders filled with 0.
[0138] Step 213: The model receives the predicted value from the decoder and determines whether the difference between the predicted value at time t+1 and the true value at time t and the difference between the true value at time t+1 and the true value at time t are in the same direction. When the two are in the same direction, the mean square error of the predicted value and the true value is used as the loss function. In addition, when the change trend of the predicted value and the true value is opposite, the penalty factor γ is introduced to increase the loss value.
[0139] Step 214: When the model is trained to the lowest loss value, it is considered that the model has reached the optimal state.
[0140] Step 301: Input the software feature parameters into the optimal model trained in step 214, and let the model output the resource usage prediction value for product development.
[0141] Based on the introduction of the above application scenarios, it can be seen that the prediction method provided by the embodiment of the present application has the advantages of higher accuracy and lower complexity. By transforming the structure in the probabilistic sparse attention mechanism and optimizing the outliers in the calculation process, not only can the model complexity be compressed, but also the influence of outliers on feature learning can be eliminated. Then, a loss function that can capture the trend of resource usage changes is constructed to enhance the model's ability to learn the resource usage change curve and further improve the model's prediction accuracy.
[0142] It should be noted that although the steps of the method in the present application are described in a specific order in the drawings, this does not require or imply that the steps must be performed in this specific order, or that all the steps shown must be performed to achieve the desired results. Additionally or alternatively, some steps may be omitted, multiple steps may be combined into one step, and / or one step may be decomposed into multiple steps, etc.
[0143] The following introduces an apparatus embodiment of the present application, which can be used to execute the resource usage prediction method in the above-mentioned embodiment of the present application. Figure 6 The structure block diagram of the resource usage prediction device provided in the embodiment of the present application is schematically shown. Figure 6 As shown, the resource usage prediction device 600 includes:
[0144] The extraction module 610 is configured to extract parameters of the prediction object to obtain attribute parameters that are correlated with the resource usage of the prediction object;
[0145] The encoding module 620 is configured to perform encoding processing on the attribute parameter to obtain a feature sequence of the prediction object, wherein the feature sequence includes a plurality of feature values;
[0146] A detection module 630 is configured to perform anomaly detection on the feature values in the feature sequence to obtain normal feature values and abnormal feature values;
[0147] A weighting module 640 is configured to perform weighted processing on the abnormal feature value according to the normal feature value to obtain a modified feature value;
[0148] The decoding module 650 is configured to decode the feature sequence including the normal feature value and the modified feature value to obtain a predicted value of the resource usage of the predicted object.
[0149] In some embodiments of the present application, based on the above technical solution, the detection module 630 further includes:
[0150] An acquisition module is configured to acquire a relative entropy between the attention probability distribution and the uniform distribution of the feature sequence, wherein the relative entropy is used to represent a degree of difference between the attention probability distribution and the uniform distribution;
[0151] A prediction module, configured to select feature values far from the uniform distribution from the feature sequence according to the relative entropy, and predict a probability distribution model of the feature values;
[0152] A first determining module is configured to determine the characteristic value as a normal characteristic value when the probability distribution model is a first preset model;
[0153] The second determination module is configured to determine the characteristic value as an abnormal characteristic value when the probability distribution model is a second preset model.
[0154] In some embodiments of the present application, based on the above technical solution, the first preset model is an exponential distribution model, and the second preset model is an inverse Gaussian distribution model.
[0155] In some embodiments of the present application, based on the above technical solution, the prediction module further includes:
[0156] A historical data acquisition module is configured to respectively acquire historical data corresponding to each of the characteristic values;
[0157] A probability prediction module, configured to predict the probability that the characteristic value obeys the exponential distribution model and the inverse Gaussian distribution model respectively according to the historical data;
[0158] The model determination module is configured to determine the model with a larger probability between the exponential distribution model and the inverse Gaussian distribution model as the probability distribution model of the eigenvalue.
[0159] In some embodiments of the present application, based on the above technical solution, the weighting module 640 further includes:
[0160] A threshold determination module, configured to determine a screening threshold of an abnormal feature value according to the normal feature value;
[0161] a feature value assignment module, configured to assign the abnormal feature value to zero if the absolute value of the abnormal feature value is greater than the screening threshold;
[0162] The feature value weighting module is configured to perform weighted processing on the abnormal feature value according to a preset weighting coefficient if the absolute value of the abnormal feature value is less than the screening threshold.
[0163] In some embodiments of the present application, based on the above technical solution, the threshold determination module is further configured to: calculate the median of the absolute value of the normal feature value; and determine a specified multiple of the median as a screening threshold for abnormal feature values.
[0164] In some embodiments of the present application, based on the above technical solution, the resource usage prediction device 600 further includes:
[0165] an error determination module, configured to determine a loss error and a change trend error of the resource usage according to the predicted value of the resource usage of the prediction object, wherein the loss error is used to represent the error between the predicted value and the true value of the resource usage, and the change trend prediction error is used to represent whether the predicted value and the true value of the resource usage have the same change trend;
[0166] an error weighting module, configured to perform weighted processing on the loss error according to the change trend error to obtain a corrected error;
[0167] The parameter updating module is configured to update the model parameters used for encoding and decoding processing according to the corrected error.
[0168] In some embodiments of the present application, based on the above technical solution, the error determination module is further configured to: obtain the difference between the predicted value of the resource usage of the predicted object and the actual value of the resource usage at the historical moment, and obtain the predicted value change; obtain the difference between the actual value of the resource usage of the predicted object and the actual value of the resource usage at the historical moment, and obtain the actual value change; determine the change trend error of the resource usage based on the product of the predicted value change and the actual value change.
[0169] In some embodiments of the present application, based on the above technical solution, the error weighting module is further configured as follows: if the change trend error is less than zero, the loss error is weighted according to a preset penalty coefficient, and the penalty coefficient is greater than zero.
[0170] The specific details of the resource usage prediction device provided in each embodiment of the present application have been described in detail in the corresponding method embodiments and will not be repeated here.
[0171] Figure 7 The structure block diagram of a computer system for implementing an electronic device according to an embodiment of the present application is schematically shown.
[0172] It should be noted that Figure 7 The computer system 700 of the electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.
[0173] like Figure 7 As shown, the computer system 700 includes a central processing unit 701 (CPU), which can perform various appropriate actions and processes according to the program stored in the read-only memory 702 (ROM) or the program loaded from the storage part 708 to the random access memory 703 (RAM). Various programs and data required for system operation are also stored in the random access memory 703. The central processing unit 701, the read-only memory 702 and the random access memory 703 are connected to each other through a bus 704. An input / output interface 705 (Input / Output interface, i.e., I / O interface) is also connected to the bus 704.
[0174] The following components are connected to the input / output interface 705: an input section 706 including a keyboard, a mouse, etc.; an output section 707 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker; a storage section 708 including a hard disk, etc.; and a communication section 709 including a network interface card such as a LAN card, a modem, etc. The communication section 709 performs communication processing via a network such as the Internet. A drive 710 is also connected to the input / output interface 705 as needed. A removable medium 711, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 710 as needed so that a computer program read therefrom is installed into the storage section 708 as needed.
[0175] In particular, according to an embodiment of the present application, the process described in each method flow chart can be implemented as a computer software program. For example, an embodiment of the present application includes a computer program product, which includes a computer program carried on a computer readable medium, and the computer program contains a program code for executing the method shown in the flow chart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 709, and / or installed from the removable medium 711. When the computer program is executed by the central processor 701, various functions defined in the system of the present application are executed.
[0176] It should be noted that the computer-readable medium shown in the embodiment of the present application may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, a system, device or device of electricity, magnetism, light, electromagnetic, infrared, or semiconductor, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM), a flash memory, an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present application, a computer-readable storage medium may be any tangible medium containing or storing a program, which may be used by an instruction execution system, device or device or used in combination with it. In the present application, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, wherein a computer-readable program code is carried. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer readable signal media may also be any computer readable medium other than computer readable storage media, which may send, propagate, or transmit programs for use by or in conjunction with an instruction execution system, apparatus, or device. The program code contained on the computer readable medium may be transmitted using any suitable medium, including but not limited to: wireless, wired, etc., or any suitable combination of the above.
[0177] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present application. In this regard, each box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the above-mentioned module, program segment or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0178] It should be noted that, although several modules or units of the equipment for action execution are mentioned in the above detailed description, this division is not mandatory. In fact, according to the embodiments of the present application, the features and functions of two or more modules or units described above can be embodied in one module or unit. On the contrary, the features and functions of one module or unit described above can be further divided into being embodied by multiple modules or units.
[0179] Through the description of the above implementation methods, it is easy for those skilled in the art to understand that the example implementation methods described here can be implemented by software or by combining software with necessary hardware. Therefore, the technical solution according to the implementation methods of the present application can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, and includes several instructions to enable a computing device (which can be a personal computer, a server, a touch terminal, or a network device, etc.) to execute the method according to the implementation methods of the present application.
[0180] Those skilled in the art will readily appreciate other embodiments of the present application after considering the specification and practicing the invention disclosed herein. The present application is intended to cover any modification, use or adaptation of the present application, which follows the general principles of the present application and includes common knowledge or customary technical means in the art that are not disclosed in the present application.
[0181] It should be understood that the present application is not limited to the precise structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present application is limited only by the appended claims.
Claims
1. A method for predicting resource usage, characterized in that: include: Extracting parameters of the prediction object to obtain attribute parameters that are correlated with the resource usage of the prediction object; Performing encoding processing on the attribute parameters to obtain a feature sequence of the predicted object, wherein the feature sequence includes a plurality of feature values; Performing anomaly detection on the feature values in the feature sequence to obtain normal feature values and abnormal feature values; Performing weighted processing on the abnormal characteristic value according to the normal characteristic value to obtain a modified characteristic value; The feature sequence including the normal feature value and the modified feature value is decoded to obtain a predicted value of the resource usage of the predicted object.
2. The resource usage prediction method according to claim 1, characterized in that: Performing anomaly detection on the feature values in the feature sequence includes: Obtaining a relative entropy between an attention probability distribution and a uniform distribution of the feature sequence, wherein the relative entropy is used to indicate a degree of difference between the attention probability distribution and the uniform distribution; According to the relative entropy, feature values far from the uniform distribution are selected from the feature sequence, and a probability distribution model of the feature values is predicted; When the probability distribution model is the first preset model, determining the characteristic value as a normal characteristic value; When the probability distribution model is the second preset model, the characteristic value is determined as an abnormal characteristic value.
3. The resource usage prediction method according to claim 2, characterized in that: The first preset model is an exponential distribution model, and the second preset model is an inverse Gaussian distribution model.
4. The method for predicting resource usage according to claim 3, characterized in that: The probability distribution model for predicting the characteristic value includes: Respectively obtain historical data corresponding to each of the characteristic values; Predicting the probability that the characteristic value obeys the exponential distribution model and the inverse Gaussian distribution model respectively according to the historical data; The model with a larger probability between the exponential distribution model and the inverse Gaussian distribution model is determined as the probability distribution model of the eigenvalue.
5. The resource usage prediction method according to claim 1, characterized in that: The method further comprises: performing weighted processing on the abnormal feature value according to the normal feature value, comprising: Determine a screening threshold value for abnormal characteristic values according to the normal characteristic values; If the absolute value of the abnormal feature value is greater than the screening threshold, the abnormal feature value is assigned a value of zero; If the absolute value of the abnormal feature value is less than the screening threshold, the abnormal feature value is weighted according to a preset weighting coefficient.
6. The method for predicting resource usage according to claim 5, characterized in that: Determining a screening threshold of an abnormal characteristic value according to the normal characteristic value includes: Calculate the median of the absolute value of the normal characteristic value; A specified multiple of the median is determined as a screening threshold for abnormal feature values.
7. The method for predicting resource usage according to any one of claims 1 to 6, characterized in that: After decoding the feature sequence including the normal feature value and the modified feature value, the method further includes: Determine a loss error and a change trend error of the resource usage according to the predicted value of the resource usage of the predicted object, wherein the loss error is used to indicate the error between the predicted value and the true value of the resource usage, and the change trend prediction error is used to indicate whether the predicted value and the true value of the resource usage have the same change trend; Performing weighted processing on the loss error according to the change trend error to obtain a corrected error; Model parameters used for encoding and decoding processes are updated based on the corrected error.
8. The method for predicting resource usage according to claim 7, characterized in that: Determining a change trend error of the resource usage according to a predicted value of the resource usage of the predicted object includes: Obtaining a difference between a predicted value of resource usage of the predicted object and a real value of resource usage at a historical moment to obtain a predicted value change; Obtaining a difference between a real value of resource usage of the predicted object and a real value of resource usage at a historical moment to obtain a real value change; The change trend error of the resource usage is determined according to the product of the predicted value change and the true value change.
9. The method for predicting resource usage according to claim 8, characterized in that: The loss error is weighted according to the change trend error, including: If the change trend error is less than zero, the loss error is weighted according to a preset penalty coefficient, and the penalty coefficient is greater than zero.
10. An electronic device, characterized in that: include: processor; as well as A memory, configured to store executable instructions of the processor; The processor is configured to execute the executable instructions to implement the resource usage prediction method as described in any one of claims 1 to 9.
Citation Information
Cited By
Business entity intelligent prediction system and method oriented to multi-dimensional decision support
CN121120126A