Software defect type prediction method and device, equipment and medium

By obtaining the log data and abnormal detection model of the target software, predicting the abnormal event type at the target detection moment, the problem of low accuracy of manual empirical prediction in the prior art is solved, and the efficiency of software testing is improved.

CN120540988APending Publication Date: 2025-08-26AGRICULTURAL BANK OF CHINA
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510666445.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-05-22
Publication Date
2025-08-26

AI Technical Summary

Technical Problem

In the prior art, predicting the types of software abnormal events at a certain point in the future mainly rely on manual experience, with low accuracy and cannot meet the needs of software testing.

Method used

By obtaining the log data of the target software, the probability of abnormal transfer between abnormal events is determined, and the pre-trained abnormality detection model is input, and the probability of target type abnormal events occurring at the target detection moment is used to predict the probability of target type abnormal events.

Benefits of technology

Improve the accuracy of abnormal event type prediction and improve the efficiency of software testing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120540988A_ABST
    Figure CN120540988A_ABST
Patent Text Reader

Abstract

The embodiment of the invention discloses a software defect type prediction method and device, equipment and a medium, and the method comprises the steps: obtaining log data of target software, according to the log data, determining an exception transition probability between an exception event at any detection moment before a target detection moment in a current execution cycle and a target type exception event; inputting the exception transition probability into a pre-trained exception detection model, and obtaining an occurrence probability of a target type exception event at the target detection moment output by the exception detection model, a sample pair of the anomaly detection model comprises an anomaly transition probability between a first anomaly event and a second anomaly event in a plurality of preset execution cycles and an occurrence probability of the second anomaly event. According to the technical scheme provided by the invention, the accuracy of abnormal type prediction can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of anomaly detection, and in particular to a method, device, equipment and medium for predicting software defect types. Background Art

[0002] During the software execution cycle, different types of abnormal events or software defects may occur at various points in time. These can include system crashes, data errors, communication failures, and more. These abnormal events not only reduce system stability but can also impact user experience and even cause data loss or business interruption.

[0003] Therefore, in order to ensure the accuracy of software testing, it is necessary to accurately predict the type of abnormal events at a certain point in the future, so that preventive measures can be taken in advance, the system operating environment and resource allocation can be optimized, and the reliability and availability of the software can be improved.

[0004] However, the method of predicting the type of abnormal event at a certain point in the future mainly relies on manual experience for empirical prediction. However, this method has low accuracy and cannot meet the needs of software testing. Summary of the Invention

[0005] The present invention provides a method, apparatus, device and medium for predicting software defect types. Through the technical solutions of the embodiments of the present invention, the probability of a target type of abnormal event occurring at a certain point in the future can be accurately predicted, thereby improving the accuracy of abnormality prediction and further improving the efficiency of software testing.

[0006] In a first aspect, an embodiment of the present invention provides a method for predicting software defect types, comprising:

[0007] Obtaining log data of the target software, and determining, based on the log data, an abnormal transition probability between an abnormal event at any detection moment before the target detection moment in the current execution cycle and an abnormal event of the target type;

[0008] The abnormal transition probability is input into a pre-trained abnormality detection model to obtain the probability of occurrence of a target type abnormal event at the target detection moment output by the abnormality detection model, wherein the sample pairs of the abnormality detection model include the abnormal transition probability between the first abnormal event and the second abnormal event within multiple preset execution cycles and the probability of occurrence of the second abnormal event.

[0009] In a second aspect, an embodiment of the present invention provides a software defect type prediction device, comprising:

[0010] an acquisition module, configured to acquire log data of the target software and determine, based on the log data, an abnormal transition probability between an abnormal event at any detection moment before the target detection moment in the current execution cycle and an abnormal event of the target type;

[0011] A prediction module is used to input the abnormal transition probability into a pre-trained abnormality detection model to obtain the probability of occurrence of a target type abnormal event at the target detection moment output by the abnormality detection model, wherein the sample pairs of the abnormality detection model include the abnormal transition probability between the first abnormal event and the second abnormal event within multiple preset execution cycles and the probability of occurrence of the second abnormal event.

[0012] In a third aspect, an embodiment of the present invention provides an electronic device, comprising:

[0013] at least one processor; and,

[0014] a memory communicatively connected to the at least one processor; wherein,

[0015] The memory stores a computer program that can be executed by the at least one processor. The computer program is executed by the at least one processor to enable the at least one processor to perform the software defect type prediction method according to any one of the embodiments of the present invention.

[0016] In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium, characterized in that the computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement any software defect type prediction method described in any one of the embodiments of the present invention when executed.

[0017] An embodiment of the present invention provides a method, apparatus, device, and medium for predicting software defect types. The method includes: obtaining log data of the target software, determining the abnormal transition probability between an abnormal event at any detection moment before the target detection moment in the current execution cycle and a target type abnormal event based on the log data; inputting the abnormal transition probability into a pre-trained abnormality detection model, and obtaining the probability of the target type abnormal event occurring at the target detection moment output by the abnormality detection model, wherein the sample pairs of the abnormality detection model include the abnormal transition probability between the first abnormal event and the second abnormal event within multiple preset execution cycles and the probability of the second abnormal event occurring. Specifically, the abnormality detection model can determine the changing trend between abnormal event types through the abnormal transition probabilities at each detection moment before the target detection moment, and then predict the probability of the target type abnormal event occurring at the target detection moment. Through the technical solution of the embodiment of the present invention, the accuracy of event abnormality type prediction can be improved, and the efficiency of software testing can be improved. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0019] Figure 1 A flowchart of a method for predicting software defect types provided in the first embodiment of the present invention;

[0020] Figure 2 A flowchart of a method for training an anomaly detection model provided in Example 2 of the present invention;

[0021] Figure 3 A flowchart of a method for training and using an anomaly detection model provided by an embodiment of the present invention;

[0022] Figure 4 A schematic diagram of the structure of a software defect type prediction device provided in the third embodiment of the present invention;

[0023] Figure 5 This is a structural diagram of an electronic device provided in Example 4 of the present invention. DETAILED DESCRIPTION

[0024] In order to enable those skilled in the art to better understand the solutions of the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the embodiments described are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts should fall within the scope of protection of the present invention.

[0025] It should be noted that the terms "first", "second", etc. in the description and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that the numbers used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0026] It should be noted that the collection, storage, use, processing, transmission, provision and disclosure of user personal information involved in the technical solution of this disclosure are in compliance with the provisions of relevant laws and regulations and do not violate public order and good morals.

[0027] Example 1

[0028] Figure 1 This is a flowchart of a software defect type prediction method provided in Example 1 of the present invention. This method is specifically applicable to predicting the anomaly type of abnormal events detected at various moments during the execution cycle of target software. This method can be implemented by a software defect type prediction device, which comprises software and / or hardware and is deployed in a computer or server.

[0029] like Figure 1 Shown, including:

[0030] Step 110 : Obtain log data of the target software, and determine, based on the log data, an abnormal transition probability between an abnormal event at any detection moment before the target detection moment in the current execution cycle and an abnormal event of the target type.

[0031] The execution cycle refers to the entire cycle of the target software from the start of execution to the end of execution. During the testing process, the target software needs to run repeatedly within the execution cycle and detect possible anomalies, so as to continuously improve the software. It should be noted that the abnormal event of the target software can be a defect in the target software. Therefore, the abnormal type of the target software event is essentially the defect type of the target software. Furthermore, the log data of the target software contains the abnormal events that occurred at each detection moment in the execution cycle and the specific types of these abnormal events. The detection moment is a pre-set detection time point in the execution cycle. A detection moment can be determined at the same time interval until the end of the execution cycle. For example, the type of abnormal event can be pre-set as fatal, serious, general and minor.

[0032] Specifically, the method of the present invention is based on statistics and probability. It uses the transition probabilities between historical abnormal events, combined with an anomaly detection model, to predict the probability of the target detection type occurring at the target detection moment. Furthermore, for the current execution cycle, since the type of abnormal event preceding the target detection moment has already been determined, it is not possible to directly calculate the probability using data from a single execution cycle. Instead, the abnormal transition probability is determined by statistically calculating the transitions between abnormal events across multiple historical execution cycles.

[0033] For example, the formula for abnormal transition probability is:

[0034] p lk(Δ) = P {abnormal type k occurs at time s + Δ | abnormal type l occurs at time s}

[0035] =P{I k (s+Δ)=1|I l (s) = 1};

[0036] Among them, p lk It can also be expressed as P(l|k). Δ is the lag separation vector, indicating the time difference, and s is the detection time.

[0037] Optionally, obtaining log data of the target software and determining the abnormal transition probability of the target software according to the log data includes:

[0038] For multiple execution cycles before the current execution cycle of the target software, when a target type abnormal event occurs at a target detection moment in the log data, abnormal events corresponding to each detection moment before the target detection moment are obtained.

[0039] According to the occurrence probabilities of various types of abnormal events corresponding to the detection moments before the target detection moment, the occurrence probability of the abnormal event at any detection moment before the target detection moment in the current execution cycle is determined as the abnormal transition probability.

[0040] Specifically, in multiple historical execution cycles of the target software, if the log data indicates that an abnormal event of the target type occurred at the target detection moment, it is necessary to obtain the abnormal type of the abnormal event recorded at each detection moment before the target detection moment. Furthermore, for any detection moment, the probability of occurrence of each type of abnormal event can be determined based on the number of occurrences of each type of abnormal event at that detection moment. Furthermore, based on the probability of occurrence of each type of abnormal event corresponding to each detection moment before the target detection moment, the probability of occurrence of an abnormal event at any detection moment before the target detection moment in the current execution cycle can be determined as the abnormal transition probability.

[0041] For example, the log data for historical execution cycles 1-4 are:

[0042] Execution cycle 1: (X1,B), (X2,A), (X3,C), (X1,D).

[0043] Execution cycle 2: (X1,B), (X2,B), (X3,A), (X1,C).

[0044] Execution cycle 3: (X1,B), (X2,C), (X3,D), (X1,B).

[0045] Execution cycle 4: (X1,B), (X2,A), (X3,A), (X1,D).

[0046] Among them, X1-X4 are the detection moments, A, B, C and D are the abnormality types.

[0047] Therefore, if you need to calculate the probability of type A abnormal event occurring at time X2 when type B abnormal event occurs at time X1, you can do it as follows:

[0048] The number of times B appears at time X1 is 4, and the number of times A appears at time X2 is 2, so the probability of occurrence P = 2 / 4. In this example, the target detection time is X2, and the detection time before the target detection time is X1.

[0049] Step 120: Input the abnormal transition probability into a pre-trained abnormality detection model to obtain the probability of occurrence of a target type abnormal event at the target detection moment output by the abnormality detection model, wherein the sample pairs of the abnormality detection model include the abnormal transition probability between the first abnormal event and the second abnormal event within multiple preset execution cycles and the probability of occurrence of the second abnormal event.

[0050] Specifically, at any detection moment, multiple types of abnormal events may occur. Therefore, the probability of the second abnormal event occurring is calculated as follows: the number of times the second abnormal event occurs at the target detection moment divided by the total number of abnormal events of each type occurring at the detection moment. The total number of abnormal events of each type can be considered the number of preset execution cycles. This is because for each execution cycle that occurs, an abnormal event of one type will inevitably occur at the target detection moment corresponding to the second abnormal event.

[0051] Among them, the anomaly detection model includes multiple neural networks, and different neural networks are used to predict the anomaly probability of different detection periods. Any neural network is trained based on a data set consisting of the historical anomaly transfer probability of the corresponding detection period and the theoretical probability corresponding to the historical anomaly transfer probability.

[0052] The detection period is the period before the target detection time in the execution cycle.

[0053] Specifically, in the execution cycle, the length of time before different target detection moments is different. Therefore, for different target detection moments, the data sets required for training are also different. Specifically, the data after the target detection moment cannot be used to predict the event at that moment, because these subsequent data are meaningless for the prediction of events at the current detection moment. In summary, since the execution cycle contains multiple detection moments, the period before each detection moment needs to be independently used as a detection period, and the neural network needs to be trained accordingly. Furthermore, different target detection moments need to be predicted by different neural networks. It should be noted that the structures of each neural network are basically similar, but because the data sets required for training are completely different, they must be trained independently. The specific training process will be described in detail below.

[0054] For example, if the target detection time is X3, and the time before X3 includes the time X1 and the time X2, then the training set of the neural network for predicting the target detection time should use the data of X1, X2 and X3 in the execution cycle.

[0055] Specifically, the abnormal transition probability is input into a pre-trained abnormality detection model to obtain the probability of occurrence of a target type abnormal event at the target detection moment output by the abnormality detection model.

[0056] Specifically, the mathematical expression of the probability of occurrence is:

[0057]

[0058] Among them, x1…x n They are different detection moments, x0 is the target detection moment, l1...l n is the type of abnormal event, c(x n )=l n The physical meaning of x is n The moment appeared n Type of abnormal event. Further, the physical meaning of the probability of occurrence is: when x1…x n At the detection moment, l1…l n In the case of an abnormal event of type k, the probability of the target abnormal type k occurring at the target detection time x0. It should be noted that the occurrence probability is a multi-point continuous probability.

[0059] Specifically, the mathematical expression equivalent to the probability of occurrence can be: A is used to represent c(x0)=k, and D1…D n They represent c(x1)=l1…c(x n )=l n Furthermore, the specific derivation process of the formula will not be described here.

[0060] Optionally, the type of abnormal event of the target software at the target detection moment is determined based on the occurrence probability of abnormal events of various target types at the target detection moment.

[0061] Specifically, the anomaly detection model can predict the probability of each anomaly type occurring at the target detection moment, and accordingly determine the anomaly type with the highest probability of occurring as the type of abnormal event occurring in the target software at the target detection moment.

[0062] An embodiment of the present invention provides a method for predicting software defect types, the method comprising: obtaining log data of the target software, determining the abnormal transition probability between an abnormal event at any detection moment before the target detection moment in the current execution cycle and a target type abnormal event based on the log data; inputting the abnormal transition probability into a pre-trained abnormality detection model, and obtaining the probability of occurrence of the target type abnormal event at the target detection moment output by the abnormality detection model, wherein the sample pairs of the abnormality detection model include the abnormal transition probability between the first abnormal event and the second abnormal event within multiple preset execution cycles and the probability of occurrence of the second abnormal event. Specifically, the abnormality detection model can determine the changing trend between abnormal event types through the abnormal transition probabilities at each detection moment before the target detection moment, and then predict the probability of occurrence of the target type abnormal event at the target detection moment. Through the technical solution of the embodiment of the present invention, the accuracy of event abnormality type prediction can be improved, and the efficiency of software testing can be improved.

[0063] Example 2

[0064] Figure 2 A flowchart of a training method for an anomaly detection model provided in the second embodiment of the present invention is used to train any anomaly detection model described in the embodiment of the present invention, such as Figure 2 Shown, including:

[0065] Step 210: Obtain historical abnormal transition probabilities at each detection moment in a detection period corresponding to the neural network, and determine the correlation between every two of the historical abnormal transition probabilities, wherein the detection period represents a period before a target detection moment in an execution cycle.

[0066] The calculation method of the historical abnormal transition probability is similar to that of the abnormal transition probability in the above embodiment, and is not described here in detail.

[0067] Among them, the correlation characterizes the degree of association between two historical abnormal transition probabilities and the dependence of abnormal events on the time series. By analyzing and quantifying the correlation, it is possible to more accurately predict the types of abnormalities that may occur at future detection moments and their probability of occurrence. For example, in the software testing process, it is assumed that through historical data, it is found that when "out of memory" (abnormal event A) occurs, the probability of "system crash" (abnormal event B) occurring immediately at the target detection moment is significantly higher than the probability of other abnormal events occurring, which indicates that there is a strong correlation between abnormal event A and abnormal event B. Therefore, the correlation can reflect the degree of association between the two historical abnormal transition probabilities.

[0068] Exemplarily, in the abnormal transition probability, a method for calculating the correlation between the first abnormal transition probability and the second abnormal transition probability includes:

[0069] Step 1: Obtain a plurality of first abnormal transition probabilities and a plurality of second abnormal transition probabilities; and group the plurality of first abnormal transition probabilities and the plurality of second abnormal transition probabilities into a first abnormal group and a second abnormal group, respectively.

[0070] Specifically, since samples of the execution cycle themselves are different, the calculated abnormal transition probabilities will be different due to the sample differences. Therefore, multiple first abnormal transition probabilities and second abnormal transition probabilities are obtained through different execution cycles.

[0071] Step 2: Sort the first abnormal group and the second abnormal group according to the magnitude of each first abnormal transition probability and each second abnormal transition probability; determine the position difference of each first abnormal transition probability and each second abnormal transition probability in the first abnormal group and the second abnormal group before and after sorting.

[0072] The position difference is the relative position between the position of the abnormal transition probability before sorting and the position of the abnormal transition probability after sorting.

[0073] Step 3: Determine a first average position difference based on the position difference of each first abnormal transition probability; and determine a second average position difference based on the position difference of each second abnormal transition probability.

[0074] Step 4: Determine the correlation between the first abnormal transition probability and the second abnormal transition probability based on the positional difference of each first abnormal transition probability, the positional difference of each second abnormal transition probability, the first average positional difference, the second average positional difference, and the number of abnormal transition probabilities in the first abnormal group or the second abnormal group.

[0075] For example, the correlation can be calculated using the following formula:

[0076]

[0077] Among them, R(x) and R(y) are the position differences of the first abnormal transition probability in the first abnormal group and the second abnormal transition probability in the second abnormal group, respectively. and are the first average position difference and the second average position difference, respectively, and n is the number of elements in the first anomaly group or the second anomaly group.

[0078] Step 220: Determine a first historical abnormal transition probability and a second historical abnormal transition probability based on the correlations, wherein the first historical abnormal transition probability is used to determine a theoretical probability corresponding to the historical abnormal transition probability, and the second historical abnormal transition probability is the historical abnormal transition probability input during the neural network training.

[0079] Specifically, during neural network training, theoretical probability is an important basis for adjusting network parameters. However, the probability of the target type of abnormal event occurring belongs to a complex probability distribution (i.e., multi-point probability), which makes it impossible to obtain through conventional dataset sampling or statistical methods. To address this technical difficulty, a mathematical model based on the first historical abnormal transition probability is established for theoretical deduction. Based on this deduction result, the ideal output of the model (theoretical probability) is determined.

[0080] Specifically, the first historical abnormal transition probability is used to determine the theoretical probability corresponding to the historical abnormal transition probability. Among the correlations, the third and fourth historical abnormal transition probabilities with the greatest correlation are determined, and the first abnormal transition probability is determined based on the third or fourth historical abnormal transition probabilities.

[0081] Specifically, the historical transition probabilities with the highest correlation reflect the strongest connections and regularities between different types of abnormal events, demonstrating their representativeness and stability. Using these to determine theoretical outputs can make model predictions more realistic, improve prediction accuracy, enhance anomaly diagnosis capabilities, and provide a better understanding of the transition paths of various types of abnormal events.

[0082] If the correlation between any two historical abnormal transition probabilities is greater than a preset threshold, the former of the two historical abnormal transition probabilities is used as the second abnormal transition probability; otherwise, the latter of the two historical abnormal transition probabilities is used as the second abnormal transition probability.

[0083] Specifically, when the correlation between two historical anomaly transition probabilities exceeds a preset threshold, the first one is selected as the second anomaly transition probability; otherwise, the second one is selected. This selection method ensures that the probability data used for neural network training is highly representative and stable, better reflecting the main trends of abnormal event transitions. Furthermore, by selecting different historical anomaly transition probabilities as the second anomaly transition probability based on a preset threshold, it can prevent severe self-fitting during model training and improve training accuracy.

[0084] Step 230: Determine a theoretical probability corresponding to the historical abnormal transition probability based on the first historical abnormal transition probability and a preset error parameter.

[0085] For example, the theoretical probability corresponding to the historical abnormal transition probability can be determined by the following formula:

[0086]

[0087] The numerator in the formula is the first historical abnormal transition probability, the denominator is the theoretical probability, and ε is a preset error parameter, which can represent the interaction error caused by data interaction or the time error caused by latency during the execution of the target software. This application selects a random variable with a Gaussian distribution and different means and variances as the preset error parameter.

[0088] Step 240: Input the second historical abnormal transition probability into the neural network to be trained to determine the abnormal prediction probability corresponding to the second historical abnormal transition probability.

[0089] Specifically, since the neural network was not trained successfully, the abnormal prediction probability corresponding to the second historical abnormal transfer probability has a large error. Through continuous training, the abnormal prediction probability can be gradually approached to the theoretical probability.

[0090] Step 250: Training the neural network according to the second historical abnormal transition probability, the abnormal prediction probability corresponding to the second historical abnormal transition probability, and the theoretical probability.

[0091] Optionally, a probability difference between the abnormality prediction probability corresponding to the second historical abnormal transition probability and the theoretical probability is determined; and parameters of the neural network are adjusted according to the probability difference.

[0092] Specifically, if the probability difference is less than a preset threshold, the training is completed. The training may also be completed by reaching a preset number of training rounds.

[0093] Exemplarily, the neural network function of the neural network is:

[0094]

[0095] The left side of the equation is the training output of the neural network, D i The target detection time i has D abnormal types, that is, the abnormal prediction probability corresponding to the second historical abnormal transition probability, P(D j |A) is the second historical abnormal transition probability. ω and is the link weight from the input layer to the hidden layer and from the hidden layer to the output layer of the neural network, and H is the number of hidden layer nodes, which needs to be updated during continuous training.

[0096] Furthermore, the training output can be decomposed using Bayesian theorem to make the results clearer. The specific decomposition formula is as follows.

[0097]

[0098] The two equal signs before and after are equivalent forms of training output, which can be selected by the user at his discretion.

[0099] For example, Figure 3 A flowchart of a method for training and using an anomaly detection model provided by an embodiment of the present invention. Specifically, first, the historical anomaly detection probability at each detection time is obtained, P(D1|A), P(D2|A), ..., P(D N |A); and calculate the correlation between the historical abnormal transition probabilities, determine the first target transition probability and the second target transition probability based on the correlation, and then use the formula And the theoretical probability of the default execution error calculation P(D i |AD1…D i-1 ). Furthermore, based on whether the correlation is greater than 0.5, a second target abnormal transition probability is determined from the historical abnormal transition probabilities. The anomaly detection model is trained based on the theoretical probability of the second target abnormal transition probability and the corresponding training probability. The trained anomaly detection model then predicts the probability of an abnormal event of the target type occurring at the target detection moment using the abnormal transition probability of the current execution cycle.

[0100] It should be noted that the beneficial effects of the embodiments of the present invention will be described below from the perspective of the prior art.

[0101] Specifically, the common method for calculating the multi-point posterior probability mass function is the Markov chain random field. The highlight of this theory is that there is only one jumping spatial Markov chain in the high-dimensional space. This single chain property avoids the problem of over-estimation of small classes in the type random field modeling. However, due to the multi-point quasi-posterior probability (that is, the probability of occurrence of target type abnormal events at the target detection moment in this article) P(D i |AD1…D i-1) is difficult to calculate. The general form of the Markov chain random field solution is simplified by imposing the conditional independence assumption, that is, by determining the type of abnormal events at each detection time before the target detection time in the execution cycle. Specifically, it is simplified as follows:

[0102] P(D i |AD1…D i-1 )=P(D i A), i=2,...,N.

[0103] Furthermore, probability prediction itself is an engineering approximation process. In the prior art, prediction is mainly performed in the following ways:

[0104]

[0105] Where P(A) is the prior probability of anomaly type k, which can be obtained from the proportion of K global types π1…π k Approximately, r is the probability ratio of the logistic type. After solving it, we can get:

[0106]

[0107] Among them, τ is a non-intuitive weight and is difficult to calculate accurately.

[0108] Another way is the Nu(v) expression.

[0109]

[0110] Among them, v is a single product correction factor, which represents different data interaction information and is difficult to calculate accurately.

[0111] Therefore, in the prior art, the prediction error of the occurrence probability is large due to the inability to accurately calculate τ or v. The embodiment of the present invention performs parameter fitting through a neural network, which is essentially to estimate the specific value of τ or v through a neural network, thereby improving the accuracy of the occurrence probability prediction.

[0112] The second embodiment of the present invention provides a method for training an anomaly detection model. Specifically, based on the correlations between the anomaly transition probabilities, a first historical anomaly transition probability and a second historical anomaly transition probability are determined, wherein the first historical anomaly transition probability is used to determine the theoretical probability corresponding to the historical anomaly transition probability, and the second historical anomaly transition probability is the historical anomaly transition probability input during the training of the neural network. The neural network can then be trained based on the second historical anomaly transition probability, the anomaly prediction probability corresponding to the second historical anomaly transition probability, and the theoretical probability, thereby improving the accuracy of the training so that a successfully trained anomaly detection model can accurately predict the probability of occurrence of an abnormal event of the target type at the target detection moment. By using the method of the embodiment of the present invention, the accuracy of determining the anomaly type can be improved, thereby improving the efficiency of software testing.

[0113] Example 3

[0114] Figure 4 This is a schematic diagram of the structure of a software defect type prediction device provided by the third embodiment of the present invention. Figure 4 As shown, the device includes:

[0115] The acquisition module 310 is configured to acquire log data of the target software and determine, based on the log data, an abnormal transition probability between an abnormal event at any detection moment before the target detection moment in the current execution cycle and an abnormal event of the target type.

[0116] The prediction module 320 is used to input the abnormal transition probability into a pre-trained abnormal detection model to obtain the probability of occurrence of a target type abnormal event at the target detection moment output by the abnormal detection model, wherein the sample pairs of the abnormal detection model include the abnormal transition probability between the first abnormal event and the second abnormal event within multiple preset execution cycles and the probability of occurrence of the second abnormal event.

[0117] An embodiment of the present invention provides a method, apparatus, device, and medium for predicting software defect types. The method includes: obtaining log data of the target software, determining the abnormal transition probability between an abnormal event at any detection moment before the target detection moment in the current execution cycle and a target type abnormal event based on the log data; inputting the abnormal transition probability into a pre-trained abnormality detection model, and obtaining the probability of the target type abnormal event occurring at the target detection moment output by the abnormality detection model, wherein the sample pairs of the abnormality detection model include the abnormal transition probability between the first abnormal event and the second abnormal event within multiple preset execution cycles and the probability of the second abnormal event occurring. Specifically, the abnormality detection model can determine the changing trend between abnormal event types through the abnormal transition probabilities at each detection moment before the target detection moment, and then predict the probability of the target type abnormal event occurring at the target detection moment. Through the technical solution of the embodiment of the present invention, the accuracy of event abnormality type prediction can be improved, and the efficiency of software testing can be improved.

[0118] Optionally, the anomaly detection model includes multiple neural networks, and different neural networks are used to predict the anomaly probability of different detection periods. Any neural network is trained based on a data set consisting of the historical anomaly transition probability of the corresponding detection period and the theoretical probability corresponding to the historical anomaly transition probability.

[0119] Optionally, the acquisition module 310 includes:

[0120] a statistical unit configured to, for a plurality of execution cycles before a current execution cycle of the target software, obtain, when an abnormal event of a target type occurs at a target detection moment in the log data, abnormal events corresponding to each detection moment before the target detection moment;

[0121] The calculation unit is used to determine the probability of occurrence of an abnormal event at any detection moment before the target detection moment in the current execution cycle as the abnormal transition probability based on the probability of occurrence of each type of abnormal event corresponding to each detection moment before the target detection moment.

[0122] The software defect type prediction device also includes a neural network training module for training any neural network of the anomaly detection model.

[0123] The neural network training module includes:

[0124] a correlation calculation unit, configured to obtain a historical abnormal transition probability at each detection moment in a detection period corresponding to the neural network, and determine a correlation between every two of the historical abnormal transition probabilities, wherein the detection period represents a period before a target detection moment in an execution cycle;

[0125] a judgment unit, configured to determine, based on the correlations, a first historical abnormal transition probability and a second historical abnormal transition probability, wherein the first historical abnormal transition probability is used to determine a theoretical probability corresponding to the historical abnormal transition probability, and the second historical abnormal transition probability is the historical abnormal transition probability input during the training of the neural network;

[0126] a theoretical probability determination unit, configured to determine a theoretical probability corresponding to the historical abnormal transition probability based on the first historical abnormal transition probability and a preset error parameter;

[0127] an input unit, configured to input the second historical abnormal transition probability into a neural network to be trained, and determine an abnormality prediction probability corresponding to the second historical abnormal transition probability;

[0128] A cyclic unit is used to train the neural network according to the second historical abnormal transition probability, the abnormality prediction probability corresponding to the second historical abnormal transition probability and the theoretical probability.

[0129] Optionally, the judging unit includes:

[0130] a first determining unit, configured to determine, among the correlations, a third historical abnormal transition probability and a fourth historical abnormal transition probability having the greatest correlation, and determine the first abnormal transition probability according to the third historical abnormal transition probability or the fourth historical abnormal transition probability;

[0131] The second determination unit is configured to use the first of any two historical abnormal transition probabilities as the second abnormal transition probability if the correlation between the two historical abnormal transition probabilities is greater than a preset threshold; otherwise, use the second of the two historical abnormal transition probabilities as the second abnormal transition probability.

[0132] The loop unit is specifically used to determine the probability difference between the abnormal prediction probability corresponding to the second historical abnormal transition probability and the theoretical probability; and adjust the parameters of the neural network according to the probability difference.

[0133] Optionally, the software defect type prediction device further includes: a determination module for determining the type of abnormal event of the target software at the target detection moment according to the occurrence probability of each type of abnormal event of the target type at the target detection moment.

[0134] The software defect type prediction device provided by the embodiment of the present invention can execute the software defect type prediction method provided by any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.

[0135] Example 4

[0136] Figure 5A schematic diagram of the structure of an electronic device 10 that can be used to implement an embodiment of the present invention is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices (such as helmets, glasses, watches, etc.) and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or claimed herein.

[0137] like Figure 5 As shown, the electronic device 10 includes at least one processor 11 and a memory, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc., which is communicatively connected to the at least one processor 11. The memory stores a computer program that can be executed by the at least one processor. The processor 11 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 12 or the computer program loaded from the storage unit 18 into the random access memory (RAM) 13. Various programs and data required for the operation of the electronic device 10 can also be stored in the RAM 13. The processor 11, ROM 12, and RAM 13 are connected to each other via a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.

[0138] Multiple components in the electronic device 10 are connected to the I / O interface 15, including an input unit 16, such as a keyboard, a mouse, etc.; an output unit 17, such as various types of displays, speakers, etc.; a storage unit 18, such as a magnetic disk, an optical disk, etc.; and a communication unit 19, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information / data with other devices via a computer network such as the Internet and / or various telecommunication networks.

[0139] The processor 11 can be any general-purpose and / or specialized processing component with processing and computing capabilities. Some examples of the processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various specialized artificial intelligence (AI) computing chips, various processors that run machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The processor 11 executes the various methods and processes described above, such as the software defect type prediction method.

[0140] In some embodiments, the software defect type prediction method can be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as storage unit 18. In some embodiments, part or all of the computer program can be loaded and / or installed on electronic device 10 via ROM 12 and / or communication unit 19. When the computer program is loaded into RAM 13 and executed by processor 11, one or more steps of the software defect type prediction method described above can be performed. Alternatively, in other embodiments, processor 11 can be configured to execute the software defect type prediction method in any other appropriate manner (for example, by means of firmware).

[0141] Various embodiments of the systems and techniques described above can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), system-on-chip systems (SOCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments can include being implemented in one or more computer programs that are executable and / or interpreted on a programmable system that includes at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.

[0142] Computer programs for implementing the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that when the computer program is executed by the processor, the functions / operations specified in the flowcharts and / or block diagrams are implemented. The computer program may be executed entirely on the machine, partially on the machine, as a stand-alone software package, partially on the machine and partially on a remote machine, or entirely on a remote machine or server.

[0143] In the context of the present invention, computer-readable storage media can be tangible media that can contain or store a computer program for use with an instruction execution system, device or equipment or used in combination with an instruction execution system, device or equipment. Computer-readable storage media can include but are not limited to electronic, magnetic, optical, electromagnetic, infrared or semiconductor systems, devices or equipment, or any suitable combination of the foregoing. Alternatively, computer-readable storage media can be machine-readable signal media. More specific examples of machine-readable storage media can include electrical connections based on one or more lines, portable computer disks, hard disks, random access memories (RAM), read-only memories (ROM), erasable programmable read-only memories (EPROM or flash memory), optical fibers, portable compact disk read-only memories (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.

[0144] To provide interaction with a user, the systems and techniques described herein can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the electronic device. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).

[0145] The systems and techniques described herein can be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer with a graphical user interface or web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.

[0146] A computing system may include clients and servers. The clients and servers are typically remote from each other and typically interact via a communication network. This client-server relationship arises through computer programs running on the respective computers, creating a client-server relationship. The server may be a cloud server, also known as a cloud computing server or cloud host. This server is a hosting product within the cloud computing service ecosystem that addresses the management difficulties and limited scalability of traditional physical hosting and VPS services.

[0147] It should be understood that the various forms of the processes shown above can be used to reorder, add, or delete steps. For example, the steps described in the present invention can be performed in parallel, sequentially, or in a different order, as long as the desired results of the technical solution of the present invention can be achieved. This is not limited herein.

[0148] The above specific embodiments do not limit the scope of protection of the present invention. Those skilled in the art will appreciate that various modifications, combinations, sub-combinations, and substitutions may be made based on design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of the present invention are intended to be included within the scope of protection of the present invention.

Claims

1. A software defect type prediction method, characterized in that: include: Obtaining log data of the target software, and determining, based on the log data, an abnormal transition probability between an abnormal event at any detection moment before the target detection moment in the current execution cycle and an abnormal event of the target type; The abnormal transition probability is input into a pre-trained abnormality detection model to obtain the probability of occurrence of a target type abnormal event at the target detection moment output by the abnormality detection model, wherein the sample pairs of the abnormality detection model include the abnormal transition probability between the first abnormal event and the second abnormal event within multiple preset execution cycles and the probability of occurrence of the second abnormal event.

2. The method according to claim 1, characterized in that The anomaly detection model includes multiple neural networks, and different neural networks are used to predict the anomaly probability of different detection periods. Any neural network is trained based on a data set consisting of historical anomaly transition probabilities of the corresponding detection period and theoretical probabilities corresponding to the historical anomaly transition probabilities.

3. The method according to claim 1, characterized in that The acquiring log data of the target software and determining the abnormal transfer probability of the target software according to the log data includes: For multiple execution cycles before the current execution cycle of the target software, if a target type abnormal event occurs at a target detection moment in the log data, obtaining abnormal events corresponding to each detection moment before the target detection moment; According to the occurrence probabilities of various types of abnormal events corresponding to the detection moments before the target detection moment, the occurrence probability of the abnormal event at any detection moment before the target detection moment in the current execution cycle is determined as the abnormal transition probability.

4. The method according to claim 1, wherein For any neural network, the training method of the neural network includes: Obtaining historical abnormal transition probabilities at each detection moment in a detection period corresponding to the neural network, and determining a correlation between every two of the historical abnormal transition probabilities, wherein the detection period represents a period before a target detection moment in an execution cycle; Determining a first historical abnormal transition probability and a second historical abnormal transition probability based on the correlations, wherein the first historical abnormal transition probability is used to determine a theoretical probability corresponding to the historical abnormal transition probability, and the second historical abnormal transition probability is the historical abnormal transition probability input during neural network training; Determining a theoretical probability corresponding to the historical abnormal transition probability based on the first historical abnormal transition probability and a preset error parameter; Inputting the second historical abnormal transition probability into the neural network to be trained, and determining the abnormality prediction probability corresponding to the second historical abnormal transition probability; The neural network is trained according to the second historical abnormal transition probability, the abnormality prediction probability corresponding to the second historical abnormal transition probability, and the theoretical probability.

5. The method according to claim 4, characterized in that Determining the first historical abnormal transition probability and the second historical abnormal transition probability based on the correlations includes: Among the correlations, determining the third historical abnormal transition probability and the fourth historical abnormal transition probability having the greatest correlation, and determining the first abnormal transition probability according to the third historical abnormal transition probability or the fourth historical abnormal transition probability; If the correlation between any two historical abnormal transition probabilities is greater than a preset threshold, the former of the two historical abnormal transition probabilities is used as the second abnormal transition probability; otherwise, the latter of the two historical abnormal transition probabilities is used as the second abnormal transition probability.

6. The method according to claim 3, characterized in that The training of the neural network according to the second historical abnormal transition probability, the abnormality prediction probability corresponding to the second historical abnormal transition probability, and the theoretical probability includes: determining a probability difference between the abnormality prediction probability corresponding to the second historical abnormality transition probability and the theoretical probability; Parameters of the neural network are adjusted according to the probability difference.

7. The method according to claim 1, characterized in that Also includes: The type of abnormal event of the target software at the target detection moment is determined based on the occurrence probability of each type of abnormal event of the target type at the target detection moment.

8. A software defect type prediction device, characterized in that: include: an acquisition module, configured to acquire log data of the target software and determine, based on the log data, an abnormal transition probability between an abnormal event at any detection moment before the target detection moment in the current execution cycle and an abnormal event of the target type; A prediction module is used to input the abnormal transition probability into a pre-trained abnormality detection model to obtain the probability of occurrence of a target type abnormal event at the target detection moment output by the abnormality detection model, wherein the sample pairs of the abnormality detection model include the abnormal transition probability between the first abnormal event and the second abnormal event within multiple preset execution cycles and the probability of occurrence of the second abnormal event.

9. An electronic device, characterized in that: The electronic device comprises: at least one processor; and, a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor. The computer program is executed by the at least one processor to enable the at least one processor to perform the software defect type prediction method according to any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the software defect type prediction method according to any one of claims 1 to 7 when executed.