Method, device and equipment for determining software defect probability and storage medium

By establishing a multi-neural network prediction model, the first posterior probability of the target defect type is calculated using the defect type probabilities of the previous N versions of the current version. This solves the problem of insufficient applicability of the Markov chain random field model in complex scenarios and achieves accurate prediction of software defect probability.

CN115509927BActive Publication Date: 2025-12-05AGRICULTURAL BANK OF CHINA
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211232887.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-10-10
Publication Date
2025-12-05
Estimated Expiration
2042-10-10

AI Technical Summary

Technical Problem

Existing software defect probability prediction methods based on Markov chain random field models have low applicability in complex data interaction scenarios and cannot accurately predict software defect probabilities.

Method used

By establishing a multi-neural network prediction model, using the defect type probabilities of the previous N versions as input, the first posterior probability of the target defect type is calculated, avoiding the conditional independence assumption and improving the applicability of the model.

Benefits of technology

It achieves accurate prediction of software defect probability in complex scenarios, improving the applicability of software defect probability prediction methods.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115509927B_ABST
    Figure CN115509927B_ABST
Patent Text Reader

Abstract

The application provides a software defect probability determination method, device, equipment and storage medium. The method comprises the following steps: determining a target defect type to be predicted of a current version of target software, then inputting defect probabilities corresponding to a plurality of defect types of the previous N versions of the current version into a prediction model trained in advance to obtain a first posterior probability corresponding to the target defect type, and then determining a defect probability corresponding to the target defect type of the current version according to the first posterior probability. The prediction model can be a multiple neural network, and the input and output of the multiple neural network are established, thereby avoiding the assumption of conditional independence, so that the method is suitable for determining the software defect probability in a complex scenario, and the applicability of the software defect probability determination method is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of data analysis technology, and in particular to a method, apparatus, device and storage medium for determining the probability of software defects. Background Technology

[0002] With the development of the software industry, the amount of software code has increased dramatically. At the same time, the software update cycle has gradually shortened. This increase in code volume and the shortening of update cycles inevitably lead to more defects (bugs). Therefore, predicting the probability of software defects is of great significance for software quality assurance, as predicted values ​​can be used to provide early warnings of defective software modules.

[0003] In related technologies, the probability of software defects can be predicted based on the event flow type (the type of user interaction with the software) and the modeling principle of typological random fields. Markov Chain Random Field (MCRF) is a type variable prediction model based on transition probabilities. This model's random field contains only one spatial Markov chain, and does not require assumptions about the independence of multiple chains. However, to simplify the model's calculation, a conditional independence assumption is generally applied, and the multi-point posterior probability can be factored into a combination of multiple products of two-point transition probabilities, thus obtaining the predicted probability of software defects.

[0004] However, since the above model is based on the conditional independence assumption, it is not applicable to log event stream scenarios with complex "data interactions", and therefore is not applicable to the prediction of software defect probability corresponding to such complex scenarios. Summary of the Invention

[0005] This application provides a method, apparatus, device, and storage medium for determining the probability of software defects, which helps to solve the problem of low applicability of methods for determining the probability of software defects in related technologies.

[0006] In a first aspect, this application provides a method for determining the probability of software defects, comprising:

[0007] Determine the type of target defect to be predicted in the current version of the target software;

[0008] Obtain the defect probabilities corresponding to multiple defect types in the previous N versions of the current version, where N is an integer greater than or equal to 1, and the multiple defect types include the target defect type;

[0009] The defect probabilities corresponding to multiple defect types in the previous N versions are input into the pre-trained prediction model to obtain the first posterior probability corresponding to the target defect type in the current version;

[0010] Based on the first posterior probability, the defect probability corresponding to the target defect type in the current version is determined.

[0011] In one possible implementation, the method further includes:

[0012] Acquire training data, which includes multiple first posterior probabilities corresponding to multiple defect types;

[0013] The prediction model is obtained by training the preset model using the training data.

[0014] In one possible implementation, acquiring the training data includes:

[0015] Obtain the defect types corresponding to multiple versions of multiple software programs;

[0016] Based on the defect types corresponding to the multiple versions of the multiple software, determine multiple first posterior probabilities corresponding to the multiple defect types.

[0017] In one possible implementation, determining multiple first posterior probabilities corresponding to each defect type based on the defect types corresponding to multiple versions of the multiple software includes:

[0018] The multiple versions of the software are sorted according to their version iteration time to obtain the version sequence of each software.

[0019] Defect type D among multiple defect types is determined using the following formula. i The corresponding first posterior probability:

[0020]

[0021] Where A is the target defect type, and D i There are i defect types, P(D) i |AD1…D i-1 ) represents the defect type D i The corresponding first posterior probability;

[0022] N n (AD1…D i-1 D i ) is the total number of times the target defect type, the first defect type, ..., the i-th defect type appear in the defect type corresponding to each version sequence of the software, as the first scanning combination;

[0023] N n (AD1…D i-1 ) is the total number of times the target defect type, the first defect type, ..., the (i-1)th defect type appear in the defect type corresponding to each version sequence of the software, as a second scanning combination.

[0024] In one possible implementation, the order of the first scan combination and the second scan combination corresponding to each first posterior probability is different.

[0025] In one possible implementation, the pre-trained prediction model is represented as:

[0026]

[0027] Among them, P(D) i |AD1…D i-1 For defect type i, in the target defect type A, defect type D1, ..., defect type D i-1 The probability of occurrence under the condition of simultaneous occurrence, where S and h are both activation functions of the prediction model. and Let P(D0) be the weight function, i = 2, ..., N, and P(D0) be a preset value. m |A) is defect type D m The probability of occurrence given that target defect type A has already occurred.

[0028] In one possible implementation, determining the defect probability corresponding to the target defect type in the current version based on the first posterior probability includes:

[0029] The defect probability corresponding to the target defect type is determined by the following formula:

[0030]

[0031] Where ρ is the normalization constant, P1 is the defect probability corresponding to the target defect type, and P(A|D1) is the probability of target defect type A occurring under the condition that defect type D1 has already occurred.

[0032] Secondly, this application provides an apparatus for determining the probability of software defects, comprising:

[0033] The first determination module is used to determine the type of target defect to be predicted in the current version of the target software.

[0034] The acquisition module is used to acquire the defect probabilities corresponding to multiple defect types in the previous N versions of the current version, where N is an integer greater than or equal to 1, and the multiple defect types include the target defect type;

[0035] The prediction module is used to input the defect probabilities corresponding to multiple defect types in the previous N versions into the pre-trained prediction model to obtain the first posterior probability corresponding to the target defect type in the current version.

[0036] The second determining module is used to determine the defect probability corresponding to the target defect type in the current version based on the first posterior probability.

[0037] In one possible implementation, the device further includes a training module.

[0038] The training module is used to acquire training data, which includes multiple first posterior probabilities corresponding to multiple defect types.

[0039] The prediction model is obtained by training the preset model using the training data.

[0040] In one possible implementation, the training module is further configured to:

[0041] Obtain the defect types corresponding to multiple versions of multiple software programs;

[0042] Based on the defect types corresponding to the multiple versions of the multiple software, determine multiple first posterior probabilities corresponding to the multiple defect types.

[0043] In one possible implementation, the training module is further configured to:

[0044] The multiple versions of the software are sorted according to their version iteration time to obtain the version sequence of each software.

[0045] Defect type D among multiple defect types is determined using the following formula. i The corresponding first posterior probability:

[0046]

[0047] Where A is the target defect type, and D i There are i defect types, P(D) i |AD1…D i-1 ) represents the defect type D i The corresponding first posterior probability;

[0048] N n (AD1…D i-1 D i ) is the total number of times the target defect type, the first defect type, ..., the i-th defect type appear in each software version sequence as the first scan combination;

[0049] N n (AD1…D i-1 ) is the total number of times the target defect type, the first defect type, ..., the (i-1)th defect type appear in each software version sequence as a second scan combination.

[0050] In one possible implementation, the order of the first scan combination and the second scan combination corresponding to each first posterior probability is different.

[0051] In one possible implementation, the pre-trained prediction model is represented as:

[0052]

[0053] Among them, P(D) i |AD1…D i-1 For defect type i, in the target defect type A, defect type D1, ..., defect type D i-1 The probability of occurrence under the condition of simultaneous occurrence, where S and h are both activation functions of the prediction model. and Let P(D0) be the weight function, i = 2, ..., N, and P(D0) be a preset value. m |A) is defect type D m The probability of occurrence given that target defect type A has already occurred.

[0054] In one possible implementation, the second determining module is further configured to:

[0055] The defect probability corresponding to the target defect type is determined by the following formula:

[0056]

[0057] Where ρ is the normalization constant, P1 is the defect probability corresponding to the target defect type, and P(A|D1) is the probability of the target defect type A occurring under the condition that defect type D1 has already occurred.

[0058] Thirdly, embodiments of this application provide an electronic device, including: a processor, and a memory communicatively connected to the processor;

[0059] The memory stores computer-executed instructions;

[0060] The processor executes computer execution instructions stored in the memory to implement the method for determining the probability of software defects as described in the first aspect.

[0061] Fourthly, embodiments of this application provide a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, are used to implement the method for determining the probability of software defects as described in the first aspect.

[0062] Fifthly, embodiments of this application provide a computer program product, including a computer program that, when executed by a processor, implements the method for determining the probability of software defects as described in the first aspect.

[0063] This application provides a method, apparatus, device, and storage medium for determining software defect probability. The method determines the target defect type to be predicted in the current version of the target software. Then, it obtains the defect probabilities corresponding to multiple defect types in the previous N versions of the current software. These probabilities are input into a pre-trained prediction model to obtain the first posterior probability corresponding to the target defect type. Finally, based on the first posterior probability, the defect probability corresponding to the target defect type in the current version is determined. The prediction model in this application can be a multi-neural network. By establishing the input and output of a multi-neural network, the assumption of conditional independence is avoided, making this method applicable to determining software defect probabilities in complex scenarios and improving the applicability of the method. Attached Figure Description

[0064] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.

[0065] Figure 1 This is a schematic diagram of an application scenario provided by an embodiment of this application;

[0066] Figure 2 A flowchart illustrating a method for determining the probability of software defects provided in Embodiment 1 of this application;

[0067] Figure 3 This is a flowchart illustrating a method for determining the probability of software defects provided in Embodiment 2 of this application.

[0068] Figure 4 This is a schematic diagram of the structure of a device for determining the probability of software defects provided in Embodiment 3 of this application;

[0069] Figure 5 This is a schematic diagram of the structure of an electronic device provided in Embodiment 4 of this application.

[0070] The accompanying drawings illustrate specific embodiments of this application, which will be described in more detail below. These drawings and descriptions are not intended to limit the scope of the concept in any way, but rather to illustrate the concept of this application to those skilled in the art through reference to particular embodiments. Detailed Implementation

[0071] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numbers in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this application as detailed in the appended claims.

[0072] In software statistical testing based on the DevOps (development operations, a collective term for processes, methods, and systems) cycle, a common approach is to extract information from historical events by replaying operation logs, thereby obtaining the probability of software defects occurring in the next iteration. Within this technical context, the probability of software defects can be predicted based on event flow types (the types of user-software interaction behaviors) and the principles of type random field modeling.

[0073] For example, software version defects can be categorized into very serious, serious, minor, and so on. Alternatively, to simplify calculations, defect types can be classified into two categories: defective and non-defective.

[0074] In predictive models of software defect occurrence probability, MCRF is a type variable prediction model based on transition probabilities. The random field of this model contains only one spatial Markov chain, and it does not require the assumption that multiple chains are independent of each other. However, in order to simplify the calculation of this model, the conditional independence assumption is generally applied, and the multi-point posterior probability can be factored into a combination of multiple two-point transition probabilities, thereby obtaining the predicted probability of software defects.

[0075] 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 MCRF and the conditional maximum entropy model have different underlying principles, both methods are based on the assumption of conditional independence and are not suitable for predicting software defects in log event stream scenarios with complex "data interactions".

[0076] Specifically, in order to obtain the multi-point quasi-posterior probability, MCRF makes the following conditional independence assumption:

[0077] P(D i |AD1…D i-1 )=P(D i |A) (1)

[0078] Where i = 2, ..., N, P(D) i |AD1…D i-1 For defect type i, in the target defect type A, defect type D1, ..., defect type D i-1The probability of occurrence under the condition of simultaneous occurrence, P(D) i |A) is defect type D i The probability of occurrence given that target defect type A has already occurred.

[0079] Among them, the multipoint quasi-posterior probability can be understood as the intermediate probability value of obtaining the multipoint posterior probability, that is, after obtaining the multipoint quasi-posterior probability, the multipoint posterior probability can be obtained.

[0080] In the embodiments of this application, the multi-point quasi-posterior probability is called the first posterior probability. The first posterior probability refers to the probability that a certain event has already occurred and the cause of the event is a certain factor. It can also be understood as conditional probability.

[0081] Because the expression for the conditional independence assumption is relatively simple, this assumption is widely used in predictive modeling of typological variables. However, considering the complex interactive information that may exist in log event streams, this assumption is not applicable to the prediction of software defects in log event stream scenarios with complex "data interactions".

[0082] Therefore, this application provides a method for determining the probability of software defects. By determining the input and output of the prediction model, that is, taking the probability of multiple defect types corresponding to the previous N versions of the current version as the input of the prediction model, and taking the first posterior probability corresponding to the target defect type as the output of the prediction model, the probability of the target defect type can be obtained based on the first posterior probability. This avoids the assumption of conditional independence, making the method applicable to the determination of software defect probabilities in complex scenarios and improving the applicability of the method for determining the probability of software defects.

[0083] To facilitate understanding, the following will be combined with... Figure 1 The application scenarios applicable to the embodiments of this application will be described.

[0084] Figure 1 This is a schematic diagram illustrating an application scenario provided by an embodiment of this application. Please refer to [link / reference]. Figure 1 The electronic device includes a software defect probability determination module, which can obtain the defect probability of the target defect type in the current version based on the defect probabilities of multiple defect types in the previous N versions of the target software.

[0085] The technical solutions of this application and how they solve the aforementioned technical problems are described in detail below with specific embodiments. These specific embodiments may exist independently or in combination with each other. Identical or similar concepts or processes may not be repeated in some embodiments. The embodiments of this application will now be described with reference to the accompanying drawings.

[0086] Figure 2This is a flowchart illustrating a method for determining the probability of software defects according to Embodiment 1 of this application. This method can be executed by a device for determining the probability of software defects, which can be a server. The following description uses a server as an example. The method in this embodiment can be implemented through software, hardware, or a combination of both. (Refer to...) Figure 2 The method includes the following steps.

[0087] S201. Determine the type of target defect to be predicted in the current version of the target software.

[0088] When determining the defect probability of the current version of the target software, the server can obtain the target defect type to be predicted in order to determine the defect probability of the target defect type.

[0089] In one possible implementation, the defect type of the target software can include very serious, serious, general, and minor, etc., so the target defect type can be any one of the defect types.

[0090] In another possible implementation, the defect type of the target software can include both defective and non-defective types, so the target defect type can be any of the defect types.

[0091] The target software defect type can also be described using other defect types, and this application does not limit this.

[0092] S202. Obtain the defect probabilities corresponding to multiple defect types in the previous N versions of the current version.

[0093] The server can obtain the defect probabilities corresponding to multiple defect types in the previous N versions of the target software's current version, where the target defect type is among the multiple defect types.

[0094] In other words, the server can obtain the defect probabilities of multiple defect types for each of the previous N versions of the current version. The multiple defect types can be very serious, serious, moderate, minor, etc., and N is an integer greater than or equal to 1.

[0095] S203. Input the defect probabilities corresponding to multiple defect types in the previous N versions into the pre-trained prediction model to obtain the first posterior probability corresponding to the target defect type in the current version.

[0096] After the server obtains the defect probabilities corresponding to multiple defect types in the previous N versions of the current version, it can input the defect probabilities corresponding to multiple defect types in the previous N versions into the pre-trained prediction model for prediction, and obtain the first posterior probability corresponding to the target defect type of the current version.

[0097] The pre-trained prediction model can be obtained by the server training a preset model with training data. The input of the prediction model is the defect probability corresponding to multiple defect probabilities of multiple versions, and the output is the first posterior probability of the target defect probability.

[0098] S204. Based on the first posterior probability, determine the defect probability corresponding to the target defect type in the current version.

[0099] After obtaining the first posterior probability of the target defect type in the current version of the target software, the server can determine the defect probability of the target defect type in the current version based on the first posterior probability.

[0100] For example, a method for the server to determine the defect probability corresponding to the target defect type based on the first posterior probability could be:

[0101] Determine the defect probability corresponding to the target defect type according to formula (2):

[0102]

[0103] Where ρ is the normalization constant, P1 is the defect probability corresponding to the target defect type, and P(A|D1) is the probability of target defect type A occurring given that defect type D1 has already occurred. i |AD1…D i-1 For defect type i, in the target defect type A, defect type D1, ..., defect type D i-1 The probability of occurrence under conditions of simultaneous occurrence.

[0104] In this embodiment, the server determines the target defect type to be predicted in the current version of the target software. Then, it obtains the defect probabilities corresponding to multiple defect types in the previous N versions of the current version, inputs these probabilities into a pre-trained prediction model, and obtains the first posterior probability corresponding to the target defect type. Based on the first posterior probability, the defect probability corresponding to the target defect type in the current version is then determined. The prediction model in this application can be a multi-neural network. By establishing the input and output of a multi-neural network, the assumption of conditional independence is avoided, making this method applicable to the prediction of software defect probabilities in complex scenarios and improving the applicability of the software defect probability prediction method.

[0105] The following is a detailed explanation of how to obtain a prediction model by training a preset model with training data, using Example 2.

[0106] Figure 3This is a flowchart illustrating a method for determining software defect probability according to Embodiment 2 of this application. This method can be executed by a device for determining software defect probability, which can be a server. The following description uses a server as an example. The method in this embodiment can be implemented through software, hardware, or a combination of both. (Refer to...) Figure 3 The method includes the following steps.

[0107] S301. Obtain training data, which includes multiple first posterior probabilities corresponding to multiple defect types.

[0108] In one possible implementation, the server can obtain training data in the following way:

[0109] The server can obtain the defect types corresponding to multiple versions of multiple software, and then determine the first posterior probabilities corresponding to the multiple defect types based on the defect types corresponding to the multiple versions of multiple software.

[0110] Specifically, the server can sort multiple versions of multiple software programs according to their version iteration times to obtain a version sequence for each software program. In other words, it sorts multiple versions of each software program according to their update times to obtain a version sequence.

[0111] Then, the defect type D among the multiple defect types is determined using formula (3). i The corresponding first posterior probability:

[0112]

[0113] Where A is the target defect type, and D i There are i defect types, P(D) i |AD1…D i-1 () represents defect type D i The corresponding first posterior probability.

[0114] N n (AD1…D i-1 D i ) is the total number of times the target defect type, the first defect type, ..., the i-th defect type appear in the defect type corresponding to each version sequence of the software, as the first scan combination.

[0115] N n (AD1…D i-1 ) is the total number of times the target defect type, the first defect type, ..., the (i-1)th defect type appear in the defect type corresponding to each version sequence of the software, as a second scan combination.

[0116] The order of the first scan combination and the second scan combination corresponding to each first posterior probability is different.

[0117] It is understandable that the more training data there is, the better the training results of the preset model will be. Furthermore, when the order of the first scan combination is different, the total number of times it appears in each software version sequence will be different, and the same applies to the second scan combination.

[0118] Therefore, in order to increase the amount of training data, that is, to increase the number of first posterior probabilities corresponding to the defect types of multiple versions of multiple software, the server can adjust the order of the first scan combination and the second scan combination.

[0119] In other words, for defect type D i When the order of the first scan combination and the second scan combination is fixed, the corresponding first posterior probability will be a single value. Therefore, the server can adjust the order of the first scan combination and / or the second scan combination to obtain multiple first posterior probabilities.

[0120] For example, the order of the first scan combination can be: target defect type, first defect type, ..., i-th defect type. Alternatively, the order of the first scan combination can also be: first defect type, target defect type, ..., i-th defect type, etc.

[0121] Similarly, the order of the second scan combination can be: target defect type, first defect type, ..., i-1th defect type. Alternatively, the order of the second scan combination can also be: first defect type, target defect type, ..., i-1th defect type, etc.

[0122] If the order of the first scan combination and / or the second scan combination is different, then the number of times the first scan combination and the second scan combination appear in the defect type corresponding to each software version sequence will be different, thus making the total number of times they appear in the defect type corresponding to multiple software version sequences different.

[0123] Therefore, the first posterior probability obtained according to formula (3) will be different, thus increasing the number of first posterior probabilities.

[0124] S302. Train the preset model using training data to obtain the prediction model.

[0125] After the server obtains the training data, it can use the training data to train a preset model to obtain a prediction model. The preset model can be a multi-neural network.

[0126] The prediction model can be expressed as:

[0127]

[0128] Among them, P(D) i |AD1…D i-1 For defect type i, in the target defect type A, defect type D1, ..., defect type D i-1 The probability of occurrence under the condition of simultaneous occurrence, where S and h are both activation functions of the prediction model. and Let P(D0) be the weight function, i = 2, ..., N, and P(D0) be a preset value, which is generally 1. m |A) is defect type D m The probability of occurrence given that target defect type A has already occurred.

[0129] In this embodiment, the server can acquire training data, which includes multiple first posterior probabilities corresponding to multiple defect types. Then, the server trains a preset model using the training data to obtain a prediction model. This prediction model can be used to predict the defect probability of the target defect type in the current version of the target software. This avoids the assumption of conditional independence and makes the method for determining the software defect probability of this application applicable to the prediction of software defect probability in complex scenarios, thus improving the applicability of the software defect probability prediction method.

[0130] Figure 4 This is a schematic diagram of a device for determining the probability of software defects according to Embodiment 3 of this application. (Reference) Figure 4 The device 40 includes: a first determining module 401, an acquiring module 402, a prediction module 403, and a second determining module 404.

[0131] The first determining module 401 is used to determine the type of target defect to be predicted in the current version of the target software.

[0132] The acquisition module 402 is used to acquire the defect probabilities corresponding to multiple defect types in the previous N versions of the current version, where N is an integer greater than or equal to 1, and the multiple defect types include the target defect type.

[0133] The prediction module 403 is used to input the defect probabilities corresponding to multiple defect types in the previous N versions into the pre-trained prediction model to obtain the first posterior probability corresponding to the target defect type in the current version.

[0134] The second determining module 404 is used to determine the defect probability corresponding to the target defect type in the current version based on the first posterior probability.

[0135] In one possible implementation, the device 40 further includes a training module.

[0136] The training module is used to acquire training data, which includes multiple first posterior probabilities corresponding to multiple defect types.

[0137] A prediction model is obtained by training a pre-defined model using training data.

[0138] In one possible implementation, the training module is also used for:

[0139] Obtain the defect types corresponding to multiple versions of multiple software programs.

[0140] Based on the defect types corresponding to multiple versions of multiple software, determine multiple first posterior probabilities corresponding to multiple defect types.

[0141] In one possible implementation, the training module is also used for:

[0142] Multiple versions of multiple software programs are sorted according to their version iteration time to obtain the version sequence of each software program.

[0143] Defect type D among multiple defect types is determined using the following formula. i The corresponding first posterior probability:

[0144]

[0145] Where A is the target defect type, and D i There are i defect types, P(D) i 1AD1…D i-1 () represents defect type D i The corresponding first posterior probability.

[0146] N n (AD1…D i-1 D i ) is the total number of times the target defect type, the first defect type, ..., the i-th defect type appear in the defect type corresponding to each version sequence of the software, as the first scan combination.

[0147] N n (AD1…D i-1 ) is the total number of times the target defect type, the first defect type, ..., the (i-1)th defect type appear in the defect type corresponding to each version sequence of the software, as a second scan combination.

[0148] In one possible implementation, the order of the first scan combination and the second scan combination corresponding to each first posterior probability is different.

[0149] In one possible implementation, the pre-trained prediction model is represented as:

[0150]

[0151] Among them, P(D) i |AD1…D i-1 For defect type i, in the target defect type A, defect type D1, ..., defect type D i-1 The probability of occurrence under the condition of simultaneous occurrence, where S and h are both activation functions of the prediction model. and Let P(D0) be the weight function, i = 2, ..., N, and P(D0) be a preset value. m |A) is defect type D m The probability of occurrence given that target defect type A has already occurred.

[0152] In one possible implementation, the second determining module 404 is further configured to:

[0153] The defect probability corresponding to the target defect type is determined by the following formula:

[0154]

[0155] Where ρ is the normalization constant, P1 is the defect probability corresponding to the target defect type, and P(A|D1) is the probability of target defect type A occurring under the condition that defect type D1 has already occurred.

[0156] The apparatus of this embodiment can be used to execute the steps of a method for determining the probability of software defects in Embodiment 1 or Embodiment 2. The specific implementation and technical effects are similar, and will not be described again here.

[0157] Figure 5 This is a schematic diagram of the structure of an electronic device provided in Embodiment 4 of this application, as shown below. Figure 5 As shown, the electronic device 50 may include at least one processor 501 and a memory 502.

[0158] The memory 502 is used to store programs. Specifically, the program may include program code, which includes computer operation instructions.

[0159] The memory 502 may include high-speed random access memory (RAM) and may also include non-volatile memory, such as at least one disk storage device.

[0160] The processor 501 is used to execute computer execution instructions stored in the memory 502 to implement the method described in the foregoing method embodiments. The processor 501 may be a central processing unit (CPU), an application-specific integrated circuit (ASIC), or one or more integrated circuits configured to implement the embodiments of this application.

[0161] Optionally, the electronic device 50 may also include a communication interface 503. In specific implementations, if the communication interface 503, memory 502, and processor 501 are implemented independently, they can be interconnected via a bus to complete communication. The bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. Buses can be categorized as address buses, data buses, control buses, etc., but this does not imply that there is only one bus or one type of bus.

[0162] Optionally, in a specific implementation, if the communication interface 503, memory 502, and processor 501 are integrated on a single chip, then the communication interface 503, memory 502, and processor 501 can communicate through an internal interface.

[0163] Electronic devices 50 can be chips, modules, IDEs, terminal devices, servers, etc.

[0164] The electronic device in this embodiment can be used to execute the steps of a method for determining the probability of software defects in Embodiment 1 or Embodiment 2. The specific implementation and technical effects are similar, and will not be described again here.

[0165] Embodiment 7 of this application provides a computer-readable storage medium, which may include various media capable of storing computer-executable instructions, such as a USB flash drive, a portable hard drive, a read-only memory (ROM), RAM, a disk, or an optical disk. Specifically, the computer-readable storage medium stores computer-executable instructions, which, when executed by a processor, are used to implement the steps of a method for determining the probability of software defects as described in Embodiment 1 or Embodiment 2. The specific implementation and technical effects are similar and will not be repeated here.

[0166] This application provides a computer program product in embodiment eight, including a computer program. When the computer program is executed by a processor, it implements the steps of determining the probability of a software defect in embodiment one or embodiment two. The specific implementation method and technical effect are similar, and will not be repeated here.

[0167] The above description is merely a preferred embodiment of this application and an explanation of the technical principles employed. Those skilled in the art should understand that the scope of disclosure in this application is not limited to technical solutions formed by specific combinations of the above-described technical features, but should also cover other technical solutions formed by arbitrary combinations of the above-described technical features or their equivalents without departing from the above-described concept. For example, technical solutions formed by substituting the above features with (but not limited to) technical features with similar functions disclosed in this application.

[0168] Furthermore, while the operations are described in a specific order, this should not be construed as requiring these operations to be performed in the specific order shown or in a sequential order. Multitasking and parallel processing may be advantageous in certain environments. Similarly, while several specific implementation details are included in the above discussion, these should not be construed as limiting the scope of this application. Certain features described in the context of individual embodiments may also be implemented in combination in a single embodiment. Conversely, various features described in the context of a single embodiment may also be implemented individually or in any suitable sub-combination in multiple embodiments.

[0169] Although the subject matter has been described using language specific to structural features and / or methodological logic, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. Rather, the specific features and actions described above are merely illustrative examples of implementing the claims.

Claims

1. A method of determining a probability of a software defect, characterized by, The method comprises the following steps: determining a target defect type to be predicted of a current version of target software; obtaining defect probabilities corresponding to a plurality of defect types of N previous versions of the current version, wherein N is an integer greater than or equal to 1, and the plurality of defect types include the target defect type; inputting the defect probabilities corresponding to the plurality of defect types of the N previous versions into a pre-trained prediction model to obtain a first posterior probability corresponding to the target defect type of the current version; determining a defect probability corresponding to the target defect type of the current version according to the first posterior probability; the pre-trained prediction model is represented as: wherein, is a defect type is a defect type is a defect type is a defect type is a probability of occurrence under the condition of simultaneous occurrence, S and h are activation functions of the prediction model, and is a weight function, , is a preset numerical value, is a defect type is a probability of occurrence under the condition that the target defect type A has occurred; the determination of the defect probability corresponding to the target defect type according to the first posterior probability comprises: the defect probability corresponding to the target defect type is determined by the following formula: wherein, is a normalization constant, is a defect probability corresponding to the target defect type, is a target defect type A in defect type occurred under the condition.

2. The method of claim 1, wherein, the method further comprises: obtaining training data, wherein the training data includes a plurality of first posterior probabilities corresponding to a plurality of defect types; training a preset model by using the training data to obtain the prediction model.

3. The method of claim 2, wherein, the obtaining of the training data comprises: obtaining defect types corresponding to a plurality of versions of a plurality of software; determining a plurality of first posterior probabilities corresponding to a plurality of defect types according to the defect types corresponding to the plurality of versions of the plurality of software.

4. The method of claim 3, wherein, the determination of the plurality of first posterior probabilities corresponding to the plurality of defect types according to the defect types corresponding to the plurality of versions of the plurality of software comprises: sorting the plurality of versions of the plurality of software according to version iteration time to obtain a version sequence of each software; A defect type among the plurality of defect types is determined by the following equation The corresponding first posterior probability: wherein A is the target defect type, is a defect type, is the defect type a corresponding first posterior probability; is the total number of times the target defect type, the first defect type, …, the ith defect type appears in each software version sequence corresponding to the defect type; It is the target defect type, the first defect type, ..., the first defect type. Defect type is the total number of times it appears in the defect type corresponding to each software version sequence, as the second scan combination.

5. The method of claim 4, wherein, the arrangement orders of the first scan combination and the second scan combination corresponding to each first posterior probability are different.

6. A device for determining the probability of software defects, characterized in that, The device is used to execute the method according to any one of claims 1-5, and the device comprises: a first determination module configured to determine a target defect type to be predicted of a current version of target software; an obtaining module configured to obtain defect probabilities corresponding to a plurality of defect types of N previous versions of the current version, wherein N is an integer greater than or equal to 1, and the plurality of defect types include the target defect type; a prediction module configured to input the defect probabilities corresponding to the plurality of defect types of the N previous versions into a pre-trained prediction model to obtain a first posterior probability corresponding to the target defect type of the current version; a second determination module configured to determine a defect probability corresponding to the target defect type of the current version according to the first posterior probability.

7. An electronic device, comprising: The device comprises: a processor and a memory connected with the processor; the memory stores computer execution instructions; the processor executes the computer execution instructions stored in the memory to implement the method for determining a software defect probability according to any one of claims 1-5.

8. A computer-readable storage medium, characterized in that, The computer readable storage medium stores computer execution instructions, and the computer execution instructions are executed by the processor to implement the method for determining a software defect probability according to any one of claims 1-5.

Citation Information

Patent Citations

  • Software defect prediction method and device

    CN109634833A

  • Software defect prediction method and device, electronic equipment and computer storage medium

    CN113656325A