A software defect occurrence situation prediction method, device, equipment and storage medium
By constructing and optimizing a target software defect prediction model, and utilizing neural networks and Markov chain random field models, the problems of accuracy and weight estimation in software defect prediction in existing technologies are solved, and accurate prediction of software defect types and probabilities is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- AGRICULTURAL BANK OF CHINA
- Filing Date
- 2022-10-28
- Publication Date
- 2026-06-05
AI Technical Summary
Existing software defect prediction methods struggle to accurately predict the types and probabilities of software defects in DevOps-based statistical testing, especially in complex log event stream scenarios. Traditional models suffer from unreasonable assumptions about conditional independence and difficulty in estimating weights.
A pre-trained target software defect prediction model is used, including a target transition probability neural network model, a target neuron Markov chain random field model, a target constrained neural network model, or a target Bayesian update neural network model. By acquiring defect occurrence probability data, the type of software defect and its probability are determined.
It achieves accurate prediction of the type and probability of software defects in the target software version, improves the accuracy and flexibility of prediction, and overcomes the limitations of assumptions and the difficulty of weight estimation in traditional models.
Smart Images

Figure CN116048956B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of software testing technology, and in particular to a method, apparatus, device, and storage medium for predicting the occurrence of software defects. Background Technology
[0002] In DevOps-based software statistical testing, a common approach is to extract knowledge from historical events by replaying operational logs, thereby obtaining the probability of software defect types occurring in the next iteration. Within this technical context, software defect types and their probabilities can be predicted based on event flow types and typed random field modeling theory.
[0003] First, consider a software version defect type C(x0) to be predicted. Take K mutually independent and exhaustive state types, meaning that at any time x0 after release, c(x0)∈{1,…,K}. When no other information is available, we can assume that the probability mass function of C(x0) is stationary, i.e., the type proportion of C(x0) is independent of the time point x0 and can be determined by K global type proportions π1,…,π K Approximation. A core problem in typological random field prediction and simulation is that, given N observation times x1,…,x… N The corresponding event type labels c(x1),...,c(x N Estimate the conditional probability mass function of C(x0) under the premise of ), where x1,…,x N These can be sampling points arranged in ascending order of their time distance from x0. Therefore, the task of uncertainty modeling for the probability of software defects can be expressed as estimating the conditional probability mass function P{C(x0)|c(x1),…,c(x2)}. N To simplify the notation, A and D1,…,D can be used. N Let C(x0) and C(x1), ..., C(x2) represent C(x0) and C(x1), respectively. N Events in the sample space, using This is used to represent the complementary event of event A.
[0004] The transition probability function is a unidirectional, asymmetric mathematical model defined on the lag distance that satisfies probabilistic constraints, with the transition probability p. lk The essence of (Δ) is conditional probability, and its mathematical expression is:
[0005] p lk (Δ) = P{defect type k appears at time s + Δ | defect type l appears at time s}
[0006] =P{I k (s+Δ)=1|I l (s)=1}
[0007] Here, I is the indicator variable, and Δ represents the lag distance segmentation vector. As the lag distance Δ... i ,Δ i With the continuous increase of ∈Δ, all transition probabilities on the j-th software version This will form a graph of the transition probability function. If we ignore the differences in transition probabilities with respect to software versions, then the transition probability for the i-th software version can be simplified to...
[0008] In predictive modeling of software defect occurrence probabilities, Markov chain random fields (MCFs) are a type variable prediction model based on transition probabilities. The key advantage of this model is that it contains only a single spatial Markov chain, thus eliminating the need for assumptions about the independence of multiple chains and preventing inconsistent state types during transitions. However, the general expression of this model is quite complex and cannot be directly used for probability calculations. To simplify the calculations, by applying the conditional independence assumption, the multi-point posterior probability can be factored into a combination of products of multiple two-point transition probabilities.
[0009] From another statistical perspective, the conditional maximum entropy method can solve the high computational cost problem faced by the classic Bayesian maximum entropy model. Although Markov chain random fields and conditional maximum entropy models have different theoretical backgrounds, both methods are based on the assumption of conditional independence and are not suitable for log event stream scenarios with complex "data interactions".
[0010] The study of data interactions in high-dimensional spaces has ultimately led to a series of analytical models, among which the Tau model and the Nu expression are the most well-known. Both methods are based on the ratio persistence, a well-known axiom in engineering approximation: the ratio of probabilities is more stable than the probability ratio. In recent years, this robustness has led to the widespread use of the ratio persistence method in modeling event-based typological variables to relax the conditional independence assumption. However, a challenge faced by the Tau model is the acquisition of non-intuitive weights. The Nu model integrates potentially complex data interaction information into a multiplicative correction parameter, the value of which is difficult to estimate, although its precise expression can be given.
[0011] Although the Tau model and Nu expression are more robust than Markov chain random fields and conditional maximum entropy models based on the conditional independence assumption, the first two methods still impose some additional assumptions to seek the relationship between multi-point quasi-posterior probabilities and two-point transition probabilities, which are difficult to obtain directly.
[0012] To establish the relationship between multi-point quasi-posterior probabilities and two-point transition probabilities, classical models are often based on a series of subjective assumptions. According to the definition of conditional probability, the probability mass function can be decomposed into...
[0013]
[0014] Here, x1 represents the time node closest to x0 in the N event stream. To obtain the multi-point quasi-posterior probability, Markov chain random field theory makes the following conditional independence assumption:
[0015] P(D i |AD1…D i-1 )=P(D i |A), i=2,…,N
[0016] Because the expression is relatively simple, this assumption is widely used in predictive modeling of type variables. However, considering the complex interactive information that may exist in log event streams, the rationality of this assumption in the real world remains to be verified.
[0017] From the perspective of probability ratios, the Tau model assumes...
[0018]
[0019] The Nu expression assumes that
[0020]
[0021] Both methods introduce additional weights τ i and υ i To replace the conditional independence assumption. It is not difficult to see that, similar to the classic Markov chain random field model, the power or product relationship between the multi-point quasi-posterior probability and the two-point transition probability also introduces subjective guesswork, and its applicability in predicting real-world software defects is also questionable. Summary of the Invention
[0022] This invention provides a method, apparatus, device, and storage medium for predicting the occurrence of software defects, so as to accurately predict the types and probabilities of software defects that may occur in a target software version.
[0023] According to one aspect of the present invention, a method for predicting the occurrence of software defects is provided, the method comprising:
[0024] Acquire defect occurrence probability data of the target software, the defect occurrence probability data including the defect transfer probability of the target software between two different observation times;
[0025] Using a pre-trained target software defect prediction model, the software defect occurrence status of the target software at the target observation time is determined based on the defect occurrence probability data. The software defect occurrence status includes the software defect type of the target software and its corresponding software defect occurrence probability.
[0026] Optionally, the target software defect prediction model can be a pre-constructed and optimized target transition probability neural network model, target neuron Markov chain random field model, target constrained neural network model, or target Bayesian update neural network model.
[0027] Optionally, the construction process of the target transition probability neural network model includes:
[0028] Initialize a two-layer transition probability neural network, which has H hidden layer nodes and inner and outer layer activation functions of respectively. and ψ;
[0029] Defect occurrence probability data As an input node, the multi-point probability y k =P(k|l1l2…l N ) is the output node, where N is the number of historical observation times, k, l1, ... l N ∈{1,2,…,K}, where K is the number of software defect types. ψ h (·)=ψ(·), thus obtaining the target transition probability neural network model.
[0030]
[0031] in, and These represent the link weights from the input layer to the hidden layer and from the hidden layer to the output layer, respectively.
[0032] Optionally, the construction process of the target neuron Markov chain random field model includes:
[0033] Constructing a neuronal Markov chain random field;
[0034] Defect occurrence probability data As an input node, the multi-point probability y k =P(k|l1l2…l N ) is the output node, where N is the number of historical observation times, k, l1, ... l N ∈{1,2,…,K}, where K is the number of software defect types, and the activation function is... function of unit The activation function ψ(·) is the softmax function, resulting in the Markov chain random field model of the target neuron.
[0035]
[0036] in, ρ j =exp(α) 0j), j = 1, 2, ..., K.
[0037] Optionally, the process of constructing the target constrained neural network model includes:
[0038] Construct a constrained neural network model;
[0039] Let the probability data of defect occurrence be x = [ln(r1 / r0), ln(r2 / r0), ..., ln(r N [ / r0)] is used as the input node, and the multi-point probability y k =P(k|l1l2…l N ) is the output node, where N is the number of historical observation times, k, l1, ... l N ∈{1,2,…,K}, where K is the number of software defect types, and the activation function is... Given a unit function and an activation function ψ(·) as the logistic function, we obtain the target constrained neural network model.
[0040]
[0041] in, ρ0 = exp(-α0).
[0042] Optionally, the construction process of the target Bayesian update neural network model includes:
[0043] Construct a Bayesian update neural network model;
[0044] The probability data of defect occurrence x = (q1, q2, ..., q N As the input node, the multi-point probability y k =P(k|l1l2…l N ) is the output node, where N is the number of historical observation times, k, l1, ... l N ∈{1,2,…,K}, where K is the number of software defect types, and the activation function is... The activation function is the unit function, ψ(·) is the beta cumulative distribution function, and H is the activation function. θ,δ (·) represents the continuously differentiable cumulative distribution function, leading to the target Bayesian update neural network model.
[0045]
[0046] in,
[0047] Optionally, the selection process for the target software defect prediction model includes:
[0048] Acquire a preset number of historical software defect occurrence data, and mark each of the historical software defect occurrence data;
[0049] Using the target transition probability neural network model, software defects are predicted based on the historical software defect occurrence data to obtain a first prediction accuracy.
[0050] Using the target neuron Markov chain random field model, software defects are predicted based on the historical software defect occurrence data to obtain a second prediction accuracy.
[0051] Using the target constrained neural network model, software defect prediction is performed on each of the historical software defect occurrence data to obtain a third prediction accuracy.
[0052] The target Bayesian update neural network model is used to predict software defects based on the historical software defect occurrence data, resulting in a fourth prediction accuracy.
[0053] Based on the first prediction accuracy, the second prediction accuracy, the third prediction accuracy, and the fourth prediction accuracy, the target software defect prediction model is selected from the target transition probability neural network model, the target neuron Markov chain random field model, the target constrained neural network model, and the target Bayesian update neural network model.
[0054] According to another aspect of the present invention, a software defect occurrence prediction device is provided, the device comprising:
[0055] The observation data acquisition module is used to acquire the defect occurrence probability data of the target software, the defect occurrence probability data including the defect transfer probability of the target software between two different observation times;
[0056] The software defect prediction module is used to determine the software defect occurrence status of the target software at the target observation time based on the defect occurrence probability data using a pre-trained target software defect prediction model. The software defect occurrence status includes the software defect occurrence type of the target software and its corresponding software defect occurrence probability.
[0057] According to another aspect of the present invention, an electronic device is provided, the electronic device comprising:
[0058] At least one processor; and
[0059] A memory communicatively connected to the at least one processor; wherein,
[0060] The memory stores a computer program that can be executed by the at least one processor, the computer program being executed by the at least one processor to enable the at least one processor to perform the software defect occurrence prediction method according to any embodiment of the present invention.
[0061] According to another aspect of the present invention, a computer-readable storage medium is provided, the computer-readable storage medium storing computer instructions for causing a processor to execute and implement the software defect occurrence prediction method according to any embodiment of the present invention.
[0062] The technical solution of this invention involves acquiring defect occurrence probability data of the target software, including the defect transition probability of the target software between two different observation times; and using a pre-trained target software defect prediction model, determining the software defect occurrence status of the target software at the target observation time based on the defect occurrence probability data. The software defect occurrence status includes the software defect type and its corresponding software defect probability. This invention can accurately predict the possible software defect types and probabilities of a target software version.
[0063] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of the present invention, nor is it intended to limit the scope of the invention. Other features of the invention will become readily apparent from the following description. Attached Figure Description
[0064] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0065] Figure 1 This is a flowchart of a software defect occurrence prediction method provided in Embodiment 1 of the present invention;
[0066] Figure 2 This is a schematic diagram of the structure of a software defect occurrence prediction device provided in Embodiment 2 of the present invention;
[0067] Figure 3 This is a schematic diagram of the structure of an electronic device that implements the software defect occurrence prediction method of the present invention. Detailed Implementation
[0068] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.
[0069] It should be noted that the terms "first," "second," "historical," "target," etc., used in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0070] Example 1
[0071] Figure 1 This is a flowchart illustrating a method for predicting the occurrence of software defects according to Embodiment 1 of the present invention. This embodiment is applicable to predicting the types and probabilities of software defects. The method can be executed by a software defect occurrence prediction device, which can be implemented in hardware and / or software and can be configured in a computer device. Figure 1 As shown, the method includes:
[0072] S110. Obtain the defect occurrence probability data of the target software, including the defect transfer probability of the target software between two different observation times.
[0073] The software defect occurrence prediction method provided in this embodiment can predict the occurrence of software defects for any software version. In this embodiment, the software to be predicted can be called the target software, and the software version to be predicted is the software version at the target observation time. Different software versions of the target software can be understood as software versions at different observation times. Correspondingly, the defect transition probability can be understood as the two-point transition probability of software defect situations in two different software versions.
[0074] S120. Using a pre-trained target software defect prediction model, determine the software defect occurrence status of the target software at the target observation time based on the defect occurrence probability data. The software defect occurrence status includes the software defect occurrence type of the target software and its corresponding software defect occurrence probability.
[0075] Generally, software defects can be categorized into fatal, severe, minor, slight, and defect-free types. For simplicity, they can also be classified into two types: defective and defect-free.
[0076] In this embodiment, a target software defect prediction model can be pre-built and trained. The obtained defect occurrence probability data of the target software is used as input data to input the target software defect prediction model to obtain the software defect occurrence type of the target software at the target observation time and the corresponding software defect occurrence probability.
[0077] This invention, through its embodiments, acquires defect occurrence probability data of the target software, including defect transition probabilities between two different observation times. Using a pre-trained target software defect prediction model, it determines the software defect occurrence status of the target software at the target observation time based on the defect occurrence probability data. The software defect occurrence status includes the type of software defect and its corresponding probability. This invention can accurately predict the types and probabilities of software defects that may occur in a target software version.
[0078] Optionally, the target software defect prediction model can be a pre-built and optimized target transition probability neural network model, target neuron Markov chain random field model, target constrained neural network model, or target Bayesian update neural network model.
[0079] Optionally, the process of constructing the target transition probability neural network model may include:
[0080] Initialize a two-layer probabilistic neural network with H hidden layer nodes, and the inner and outer activation functions are respectively... and ψ;
[0081] Defect occurrence probability data As an input node, the multi-point probability y k =P(k|l1l2…l N ) is the output node, where N is the number of historical observation times, k, l1, ... l N ∈{1,2,…,K}, where K is the number of software defect types. ψ h (·)=ψ(·), thus obtaining the target transition probability neural network model.
[0082]
[0083] in, and These represent the link weights from the input layer to the hidden layer and from the hidden layer to the output layer, respectively.
[0084] The main idea behind neural networks based on transition probabilities is to apply a nonlinear transformation to the input transition probabilities and treat the posterior probability as an output feature. This embodiment approximates the complex relationship between target multi-point and two-point probabilities by selecting different input nodes and activation functions, thereby optimizing traditional software defect occurrence prediction models from a neural network perspective.
[0085] Software defect occurrence prediction methods based on transition probability neural networks rely on feedforward-backpropagation neural networks. These models can be described as applying a series of function transformations to a linear combination of input nodes using continuously differentiable activation functions. This embodiment aims to approximate the N-dimensional interaction function F. Here... and Let F be the input space and the output space, respectively, and be N-dimensional and 1-dimensional Euclidean real spaces. This function can estimate the spatial interaction flow from the starting region to the ending region. The function F is unknown, but a finite sample set Z = {z...} is often given. k =(x k ,y k )}, and satisfy k∈{1,2,…,K}. The set Z is a pair of input and output vectors, and the main task of the transition probability neural network model is to provide a specific form of continuous function to approximate or interpolate the set Z, thereby evaluating the defect incidence rate of the software version under test. To approximate the function F, this embodiment considers a neural network model with 1 hidden layer, N input nodes, H hidden layer nodes, and K output nodes. This embodiment uses this nonlinear equation to approximate the unknown functional relationship F between the target multi-point probability and the two-point transition probability. The choice of activation function depends on the essential properties of the data and the distribution characteristics of the target variable, while the selection of optimal weights should minimize the generalization error.
[0086] Optionally, the construction process of the target neuron Markov chain random field model may include:
[0087] Constructing a neuronal Markov chain random field;
[0088] Defect occurrence probability data As an input node, the multi-point probability y k =P(k|l1l2…l N ) is the output node, where N is the number of historical observation times, k, l1, ... l N∈{1,2,…,K}, where K is the number of software defect types, and the activation function is... function of unit The activation function ψ(·) is the softmax function, resulting in the Markov chain random field model of the target neuron.
[0089]
[0090] in, ρ j =exp(α) 0j ), j = 1, 2, ..., K.
[0091] Optionally, the process of constructing a target-constrained neural network model may include:
[0092] Construct a constrained neural network model;
[0093] Let the probability data of defect occurrence be x = [ln(r1 / r0), ln(r2 / r0), ..., ln(r N [ / r0)] is used as the input node, and the multi-point probability y k =P(k|l1l2…l N ) is the output node, where N is the number of historical observation times, k, l1, ... l N ∈{1,2,…,K}, where K is the number of software defect types, and the activation function is... Given a unit function and an activation function ψ(·) as the logistic function, we obtain the target constrained neural network model.
[0094]
[0095] in, ρ0 = exp(-α0).
[0096] Optionally, the construction process of the target Bayesian update neural network model may include:
[0097] Construct a Bayesian update neural network model;
[0098] The probability data of defect occurrence x = (q1, q2, ..., q N As the input node, the multi-point probability y k =P(k|l1l2…l N ) is the output node, where N is the number of historical observation times, k, l1, ... l N ∈{1,2,…,K}, where K is the number of software defect types, and the activation function is... The activation function is the unit function, ψ(·) is the beta cumulative distribution function, and H is the activation function. θ,δ(·) represents the continuously differentiable cumulative distribution function, leading to the target Bayesian update neural network model.
[0099]
[0100] in,
[0101] For the multi-class classification problem of software defect occurrence types, each input node is assigned one of K categories. This embodiment uses a neural network model with K output nodes, each corresponding to a multinomial logistic (softmax) activation function, whose expression can be:
[0102]
[0103] in, 0≤y k ≤1 and satisfy Binary objective variable t k ∈{0,1}, where 1 represents the correct class among K categories, and the output node of the network can be understood as y k (x,ω)=p(t k =1|x). For multi-valued classification problems, the error function should be in the form of cross-entropy, i.e.
[0104]
[0105] For predicting software defects with K=2, a neural network with a single sigmoid logistic activation function can be chosen instead of a model with two outer softmax activation functions. For such highly nonlinear optimization problems, gradient descent combined with backpropagation provides a method for finding the optimal solution. To minimize the error function, the minimization procedure can be run multiple times, each time with a different randomly selected initial value ω(0), and the model's performance can be compared on independent validation sets.
[0106] Optionally, the selection process for the target software defect prediction model may include:
[0107] Acquire a preset number of historical software defect occurrence data and mark each historical software defect occurrence data;
[0108] A target transition probability neural network model is used to predict software defects based on historical software defect occurrence data, and the first prediction accuracy is obtained.
[0109] A target neuron Markov chain random field model is used to predict software defects based on historical software defect occurrence data, and a second prediction accuracy is obtained.
[0110] A target-constrained neural network model is used to predict software defects based on historical software defect occurrence data, and a third prediction accuracy is obtained.
[0111] A target Bayesian update neural network model is used to predict software defects based on historical software defect occurrence data, resulting in a fourth prediction accuracy.
[0112] Based on the first prediction accuracy, the second prediction accuracy, the third prediction accuracy, and the fourth prediction accuracy, a target software defect prediction model is selected from the target transition probability neural network model, the target neuron Markov chain random field model, the target constrained neural network model, and the target Bayesian update neural network model.
[0113] In general, Markov chain random field theory defines a jumping Markov chain. The conditional probability distribution of the random variables is derived from Bayes' theorem and the assumption of conditional independence, and its conditional probability can be expressed as:
[0114]
[0115] Here are the sampling points s1,…,s N Sort by distance from the target observation time s0 in ascending order. Ignoring differences in the transition probability function across software versions, the above equation can be simplified to:
[0116]
[0117] Compared to the above formula, the target neuron Markov chain random field model Ω in this embodiment... identity&softmax (x k The parameter α to be estimated is contained in ω). ik and ρ j If α ik =1 and for There is ρ k =ρ j Therefore, we can derive the nonparametric form represented by the above equation. Thus, α ik It can be understood as a measure of information interaction, Ω identity&softmax (x k Equation ω can be viewed as a theoretical extension of Markov chain random fields from a neural network perspective. This embodiment will use Ω... identity&softmax (x k The equation (ω) is called the Markov chain random field of the target neuron, and the unknown parameters can be learned through the feedforward backpropagation algorithm.
[0118] In the field of engineering approximation, there is a well-known axiom of ratio durability: the gain of a ratio is more robust than the gain itself. Consider the following probability ratio of logistic type:
[0119]
[0120] Here, P(A) is the prior probability of type k, which can be represented by the proportions of K global types π1,…,π. K Approximation. This model combines the prior probability of an event with the conditional probability of its occurrence given redundant data, and its specific expression is:
[0121]
[0122] This model relaxes the conditional independence assumption by introducing additional weights. The parameter τ in the Tau model... i It measures the additional contribution of a single data point to all the previously considered data. When ρ0 = r0, that is... At that time, the target-constrained neural network model proposed in this embodiment is equivalent to the Tau model to a certain extent, and τ i =-α i For i = 1, 2, ..., N, the optimal weight τ can be estimated by applying Lagrange multipliers to the objective error function. i .
[0123] The Nu(υ) expression encapsulates complex data interaction information within a single product correction factor υ0, the value of which is difficult to estimate but provides a precise analytical expression. The choice between the Tau model and the Nu expression depends on the parameter τ. i and υ i Using the same notation as the Tau model, the form of the Nu expression can be derived:
[0124]
[0125] When Ω identity&l o gistic In the formula (x,ω), α i =-1, that is At that time, the target constrained neural network model will have the same expression as the above formula, and has
[0126]
[0127] It should be noted that the main problem faced by the Tau model and Nu expression is the non-intuitive weight τ. i The difficulty in obtaining υ0. The advantage of this embodiment lies in introducing a method for estimating weight τ using a constrained transition probability neural network. i The scheme with υ0.
[0128] Bayesian update theory based on transition probabilities is used for software defect classification in expert systems. The basic idea is to first establish a linear Bayesian update using Bayes' theorem. Since linear integration is inherently suboptimal and unreliable, beta transformation Bayesian update can be used to address this limitation. N neighbor events D1, D2, ..., D... N As an expert, the transition probability P(A|D) i This can be understood as the expert opinion Q regarding whether event A occurred. i The beta transform Bayesian update model can be written as:
[0129]
[0130] Here p = P(A), Q i =P(A|D i ), u∈[0,1], and δ>0. H θ,δ (·) is the cumulative distribution function of the beta distribution with shape parameters θ and δ. i =Ε(Q i ) is Q i The mathematical expectation, λ i These are linear regression coefficients. Traditional Bayesian update models rely on statistical linear regression methods to calculate parameters, which are difficult to handle nonlinear relationships. This embodiment considers... Right now This type of Bayesian update neural network model has the same expression as the beta transform Bayesian update model. The optimal weights can be found by adding Lagrange multipliers to the beta transform Bayesian update model and combining it with the backpropagation algorithm, thereby calculating the corresponding parameters. Therefore, the software defect occurrence prediction method based on transition probability neural networks proposed in this embodiment has the advantage of more flexible parameter estimation.
[0131] Example 2
[0132] Figure 2 This is a schematic diagram of a software defect occurrence prediction device provided in Embodiment 2 of the present invention. Figure 2 As shown, the device includes:
[0133] The observation data acquisition module 210 is used to acquire the defect occurrence probability data of the target software, which includes the defect transfer probability of the target software between two different observation times.
[0134] The software defect prediction module 220 is used to determine the software defect occurrence status of the target software at the target observation time based on the defect occurrence probability data using a pre-trained target software defect prediction model. The software defect occurrence status includes the software defect occurrence type of the target software and its corresponding software defect occurrence probability.
[0135] Optionally, the target software defect prediction model can be a pre-constructed and optimized target transition probability neural network model, target neuron Markov chain random field model, target constrained neural network model, or target Bayesian update neural network model.
[0136] Optionally, the construction process of the target transition probability neural network model includes:
[0137] Initialize a two-layer transition probability neural network, which has H hidden layer nodes and inner and outer layer activation functions of respectively. and ψ;
[0138] Defect occurrence probability data As an input node, the multi-point probability y k =P(k|l1l2…l N ) is the output node, where N is the number of historical observation times, k, l1, ... l N ∈{1,2,…,K}, where K is the number of software defect types. ψ h (·)=ψ(·), thus obtaining the target transition probability neural network model.
[0139]
[0140] in, and These represent the link weights from the input layer to the hidden layer and from the hidden layer to the output layer, respectively.
[0141] Optionally, the construction process of the target neuron Markov chain random field model includes:
[0142] Constructing a neuronal Markov chain random field;
[0143] Defect occurrence probability data As an input node, the multi-point probability y k =P(k|l1l2…l N ) is the output node, where N is the number of historical observation times, k, l1, ... l N ∈{1,2,…,K}, where K is the number of software defect types, and the activation function is... function of unit The activation function ψ(·) is the softmax function, resulting in the Markov chain random field model of the target neuron.
[0144]
[0145] in, ρ j =exp(α) 0j ), j = 1, 2, ..., K.
[0146] Optionally, the process of constructing the target constrained neural network model includes:
[0147] Construct a constrained neural network model;
[0148] Let the probability data of defect occurrence be x = [ln(r1 / r0), ln(r2 / r0), ..., ln(r N [ / r0)] is used as the input node, and the multi-point probability y k =P(k|l1l2…l N ) is the output node, where N is the number of historical observation times, k, l1, ... l N ∈{1,2,…,K}, where K is the number of software defect types, and the activation function is... Given a unit function and an activation function ψ(·) as the logistic function, we obtain the target constrained neural network model.
[0149]
[0150] in, ρ0 = exp(-α0).
[0151] Optionally, the construction process of the target Bayesian update neural network model includes:
[0152] Construct a Bayesian update neural network model;
[0153] The probability data of defect occurrence x = (q1, q2, ..., q N As the input node, the multi-point probability y k =P(k|l1l2…l N ) is the output node, where N is the number of historical observation times, k, l1, ... l N ∈{1,2,…,K}, where K is the number of software defect types, and the activation function is... The activation function is the unit function, ψ(·) is the beta cumulative distribution function, and H is the activation function. θ,δ (·) represents the continuously differentiable cumulative distribution function, leading to the target Bayesian update neural network model.
[0154]
[0155] in,
[0156] Optionally, the selection process for the target software defect prediction model includes:
[0157] Acquire a preset number of historical software defect occurrence data, and mark each of the historical software defect occurrence data;
[0158] Using the target transition probability neural network model, software defects are predicted based on the historical software defect occurrence data to obtain a first prediction accuracy.
[0159] Using the target neuron Markov chain random field model, software defects are predicted based on the historical software defect occurrence data to obtain a second prediction accuracy.
[0160] Using the target constrained neural network model, software defect prediction is performed on each of the historical software defect occurrence data to obtain a third prediction accuracy.
[0161] The target Bayesian update neural network model is used to predict software defects based on the historical software defect occurrence data, resulting in a fourth prediction accuracy.
[0162] Based on the first prediction accuracy, the second prediction accuracy, the third prediction accuracy, and the fourth prediction accuracy, the target software defect prediction model is selected from the target transition probability neural network model, the target neuron Markov chain random field model, the target constrained neural network model, and the target Bayesian update neural network model.
[0163] The software defect occurrence prediction device provided in the embodiments of the present invention can execute the software defect occurrence prediction method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.
[0164] Example 3
[0165] Figure 3 A schematic diagram of an electronic device 10 that can be used to implement embodiments 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 processors, cellular phones, smartphones, wearable devices (e.g., helmets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the invention described and / or claimed herein.
[0166] like Figure 3 As shown, the electronic device 10 includes at least one processor 11 and a memory, such as a read-only memory (ROM) 12 or a random access memory (RAM) 13, communicatively connected to the at least one processor 11. The memory stores computer programs executable by the at least one processor. The processor 11 can perform various appropriate actions and processes based on the computer program stored in the ROM 12 or loaded from storage unit 18 into the RAM 13. The RAM 13 may also store various programs and data required for the operation of the electronic device 10. The processor 11, ROM 12, and RAM 13 are interconnected via a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.
[0167] Multiple components in electronic device 10 are connected to I / O interface 15, including: input unit 16, such as keyboard, mouse, etc.; output unit 17, such as various types of displays, speakers, etc.; storage unit 18, such as disk, optical disk, etc.; and communication unit 19, such as network card, modem, wireless transceiver, etc. Communication unit 19 allows electronic device 10 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.
[0168] Processor 11 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. Processor 11 performs the various methods and processes described above, such as software defect occurrence prediction methods.
[0169] In some embodiments, the software defect occurrence prediction method may be implemented as a computer program tangibly contained in a computer-readable storage medium, such as storage unit 18. In some embodiments, part or all of the computer program may 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 occurrence prediction method described above may be performed. Alternatively, in other embodiments, processor 11 may be configured to perform the software defect occurrence prediction method by any other suitable means (e.g., by means of firmware).
[0170] Various embodiments of the systems and techniques described above herein 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), systems-on-a-chip (SoCs), payload-programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.
[0171] Computer programs used to implement 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 executed by the processor, the computer programs cause the functions / operations specified in the flowcharts and / or block diagrams to be performed. The computer programs may be executed entirely on a machine, partially on a machine, or as a standalone software package, partially on a machine and partially on a remote machine, or entirely on a remote machine or server.
[0172] In the context of this invention, a computer-readable storage medium can be a tangible medium that may contain or store a computer program for use by or in conjunction with an instruction execution system, apparatus, or device. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination thereof. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.
[0173] 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 provides input to the electronic device. Other types of devices can also be used to provide interaction with the user; for example, 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 sound input, voice input, or tactile input).
[0174] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as data servers), or computing systems that include middleware components (e.g., application servers), or computing systems that include frontend components (e.g., user computers with graphical user interfaces or web browsers through which users can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., communication networks). Examples of communication networks include local area networks (LANs), wide area networks (WANs), blockchain networks, and the Internet.
[0175] A computing system can include clients and servers. Clients and servers are generally located far apart and typically interact through communication networks. The client-server relationship is created by computer programs running on the respective computers and having a client-server relationship with each other. The server can be a cloud server, also known as a cloud computing server or cloud host, which is a hosting product within the cloud computing service system to address the shortcomings of traditional physical hosts and VPS services, such as high management difficulty and weak business scalability.
[0176] It should be understood that the various forms of processes shown above can be used, with steps reordered, added, or deleted. For example, the steps described in this invention can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution of this invention can be achieved, and this is not limited herein.
[0177] The specific embodiments described above do not constitute a limitation on the scope of protection of this invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this invention should be included within the scope of protection of this invention.
Claims
1. A method for predicting the occurrence of software defects, characterized in that, include: Acquire defect occurrence probability data of the target software, wherein the defect occurrence probability data includes the defect transfer probability of the target software between two different observation times; A pre-trained target software defect prediction model is used to determine the software defect occurrence status of the target software at the target observation time based on the defect occurrence probability data. The software defect occurrence status includes the software defect occurrence type of the target software and its corresponding software defect occurrence probability. The target software defect prediction model is a target transition probability neural network model, a target neuron Markov chain random field model, a target constrained neural network model, or a target Bayesian update neural network model. The selection process for the target software defect prediction model includes: Acquire a preset number of historical software defect occurrence data, and mark each of the historical software defect occurrence data; Using the target transition probability neural network model, software defects are predicted based on the historical software defect occurrence data to obtain a first prediction accuracy. Using the target neuron Markov chain random field model, software defects are predicted based on the historical software defect occurrence data to obtain a second prediction accuracy. Using the target constrained neural network model, software defect prediction is performed on each of the historical software defect occurrence data to obtain a third prediction accuracy. The target Bayesian update neural network model is used to predict software defects based on the historical software defect occurrence data, resulting in a fourth prediction accuracy. Based on the first prediction accuracy, the second prediction accuracy, the third prediction accuracy, and the fourth prediction accuracy, the target software defect prediction model is selected from the target transition probability neural network model, the target neuron Markov chain random field model, the target constrained neural network model, and the target Bayesian update neural network model.
2. The method according to claim 1, characterized in that, The construction process of the target transition probability neural network model includes: Initialize a two-layer transition probability neural network, which has H hidden layer nodes; By using the defect occurrence probability data as input nodes and the multi-point probability as output nodes, a target transition probability neural network model is obtained.
3. The method according to claim 1, characterized in that, The construction process of the target neuron Markov chain random field model includes: Constructing a neuronal Markov chain random field; By using the probability data of defect occurrence as input nodes and the multi-point probabilities as output nodes, a Markov chain random field model of the target neuron is obtained.
4. The method according to claim 1, characterized in that, The process of constructing the target constrained neural network model includes: Construct a constrained neural network model; By using the probability data of defect occurrence as input nodes and the multi-point probabilities as output nodes, a target constrained neural network model is obtained.
5. The method according to claim 1, characterized in that, The construction process of the target Bayesian update neural network model includes: Construct a Bayesian update neural network model; By using the probability data of defect occurrence as input nodes and the multi-point probabilities as output nodes, a target Bayesian update neural network model is obtained.
6. A software defect occurrence prediction device, characterized in that, include: The observation data acquisition module is used to acquire the defect occurrence probability data of the target software, the defect occurrence probability data including the defect transfer probability of the target software between two different observation times; The software defect prediction module is used to determine the software defect occurrence status of the target software at the target observation time based on the defect occurrence probability data using a pre-trained target software defect prediction model. The software defect occurrence status includes the software defect occurrence type of the target software and its corresponding software defect occurrence probability. The target software defect prediction model is a pre-constructed and optimized target transition probability neural network model, target neuron Markov chain random field model, target constrained neural network model, or target Bayesian update neural network model. The selection process for the target software defect prediction model includes: Acquire a preset number of historical software defect occurrence data, and mark each of the historical software defect occurrence data; Using the target transition probability neural network model, software defects are predicted based on the historical software defect occurrence data to obtain a first prediction accuracy. Using the target neuron Markov chain random field model, software defects are predicted based on the historical software defect occurrence data to obtain a second prediction accuracy. Using the target constrained neural network model, software defect prediction is performed on each of the historical software defect occurrence data to obtain a third prediction accuracy. The target Bayesian update neural network model is used to predict software defects based on the historical software defect occurrence data, resulting in a fourth prediction accuracy. Based on the first prediction accuracy, the second prediction accuracy, the third prediction accuracy, and the fourth prediction accuracy, the target software defect prediction model is selected from the target transition probability neural network model, the target neuron Markov chain random field model, the target constrained neural network model, and the target Bayesian update neural network model.
7. An electronic device, characterized in that, The electronic device includes: At least one processor; and A memory communicatively connected to the at least one processor; wherein, The memory stores a computer program that can be executed by the at least one processor, the computer program being executed by the at least one processor to enable the at least one processor to perform the software defect occurrence prediction method according to any one of claims 1-5.
8. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions that cause a processor to execute the software defect occurrence prediction method according to any one of claims 1-5.