A multi-view software defect prediction method and system based on adversarial learning

By adopting multi-view adversarial learning method in software defect prediction, using deep metric learning and adversarial learning models, the problem of low single-view prediction performance is solved, and higher prediction accuracy and discrimination ability are achieved.

CN114328174BActive Publication Date: 2025-05-16SUNWAVE COMM
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202111329931.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-11-10
Publication Date
2025-05-16
Estimated Expiration
2041-11-10

AI Technical Summary

Technical Problem

The existing single-view-based software defect prediction technology has poor prediction performance and low accuracy of prediction results due to the lack of complementary information.

Method used

A multi-view software defect prediction method based on adversarial learning is proposed. By constructing a deep metric learning model and adversarial learning model, the loss function and adversarial loss function are used to build a total network to improve discrimination ability and classification performance.

Benefits of technology

Effectively mine the structural relationship between data between views, enhance the discrimination ability of network models, and improve the classification prediction performance of software defect prediction and the accuracy of prediction results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114328174B_ABST
    Figure CN114328174B_ABST
Patent Text Reader

Abstract

The present invention discloses a multi-view software defect prediction method and system based on adversarial learning, the method comprising: constructing a first network model according to multi-view software module sample data, the first network model is a view discrimination analysis loss function constructed by deep metric learning for distinguishing between similar views and heterogeneous views; constructing a second network model according to multi-view software module sample data, the second network model is an adversarial loss function constructed by adversarial learning for distinguishing different software module views in a common subspace; constructing a third network model according to the first network model and the second network model; inputting multi-view software test data into the third network model to obtain prediction results. The present invention solves the technical problems of poor prediction performance and low accuracy of prediction results of existing software defect prediction technologies based on single views.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of software defect prediction, and in particular, relates to a multi-view software defect prediction method and system based on adversarial learning. Background Art

[0002] Existing software defect prediction methods usually first build a software module set based on metrics, then design a prediction model in the existing software modules based on historical data, and finally predict the tendency of defects in new software modules.

[0003] In recent years, with the development of deep neural networks (DNN), software defect prediction methods based on generative adversarial networks (GAN) have become a new research hotspot. For example, the Chinese patent "A deep learning cross-project software defect prediction method based on GAN network" with publication number CN113419948A proposes to use a simplified abstract syntax tree to represent the code of each extracted program module in the target project and the source project; extract token vectors by deeply traversing the abstract syntax tree; embed the token vectors to obtain the word vectors corresponding to each word, and replace the tokens in the token vectors with the word vectors to convert the token vectors into numerical vectors; use the numerical vectors corresponding to the source project as input to train the source encoder and source classifier; use the numerical vectors corresponding to the target project as input, and set the initial parameters of the target encoder to be the same as the parameters of the trained source encoder; use the output features of the trained source encoder as real data in the GAN network, and then use the output features of the target encoder as false data to train through the discriminator of the GAN network; classify the output features of the target encoder with the trained source classifier; and output the classification results. The Chinese patent "A software defect prediction method based on deep migration" with publication number CN110162475A proposes to use a visualization method to convert the source code files of the source project and the target project into image files; construct a deep migration network; construct a loss function based on the maximum mean difference between the training sample features and the test sample features extracted by the self-attention mechanism, and the cross entropy of the self-check of the predicted output of the deep migration network and the true value label of the sample, and train the deep migration network with the convergence of the loss function as the goal to obtain a software defect prediction model; when applied, a visualization method is used to convert the source code file to be detected into an image, and the image is input into the software defect prediction model, and after calculation, the defect prediction result of the source code file to be detected is output.

[0004] The above-mentioned software defect prediction technology based on adversarial network is mainly based on single view, and the obtained metric meta-attributes are directly concatenated as a sample vector for subsequent feature learning. However, in the process of extracting the metric meta-attributes of software module samples, the metric meta-attributes can be divided into static software module view and dynamic software module view from the perspective of static metric and dynamic metric. Single view data often lacks complementary information compared to multi-view data. Therefore, the existing software defect prediction technology based on single view has poor prediction performance and low prediction result accuracy.

[0005] There is currently no multi-view software defect prediction technology based on adversarial networks. Therefore, a multi-view software defect prediction method based on adversarial learning is proposed. Summary of the invention

[0006] In order to solve the above problems, the present invention proposes a multi-view software defect prediction method and system based on adversarial learning.

[0007] A multi-view software defect prediction method based on adversarial learning of the present invention is characterized by comprising:

[0008] Constructing a first network model according to the multi-view software module sample data, wherein the first network model constructs an inter-view discriminant analysis loss function for distinguishing between similar views and heterogeneous views through deep metric learning;

[0009] Constructing a second network model according to the multi-view software module sample data, wherein the second network model is an adversarial loss function constructed by adversarial learning for distinguishing different software module views in a common subspace;

[0010] Constructing a third network model according to the first network model and the second network model;

[0011] The multi-view software test data is input into the third network model to obtain the prediction results.

[0012] Preferably, before constructing the first network model according to the multi-view software module sample data, the method further includes the following steps:

[0013] Normalize the metrics of the multi-view software module;

[0014] The normalized sample data of the multi-view software module are nonlinearly projected into the common subspace.

[0015] Further preferably, the normalizing the metric elements of the multi-view software module comprises the steps of:

[0016] Any software module sample in the software warehouse is represented as a static software module view composed of static metric elements and a dynamic software module view composed of dynamic metric elements; the static metric elements represent the attribute information counted after the project development is completed and finalized, and the dynamic metric elements represent the attribute information recorded during the development process;

[0017] The min-max normalization method is used to put the metrics in the static software module view and the dynamic software module view in the same dimension, that is, in the interval [0,1].

[0018] Further preferably, the non-linearly projecting the normalized sample data of the multi-view software module to the common subspace comprises the steps of:

[0019] Extracting Initial Features of Static Software Module Views from Static Software Module View Dataset Extracting initial features of dynamic software module views from dynamic software module view dataset

[0020] Construct a dual-channel network with parameter sharing;

[0021] Static software module view initial features Input four-layer FNN network to obtain static software module view specific features Dynamic software module view initial features Input four-layer FNN network to obtain dynamic software module view specific features in A four-layer FNN network mapping function representing a static software module view, Four-layer FNN network mapping function representing the dynamic software module view, Shared network parameters θ FNN .

[0022] Preferably, the constructing of an inter-view discriminant analysis loss function for distinguishing similar views from heterogeneous views by deep metric learning comprises the steps of:

[0023] Calculate the distance between the corresponding sample features of the static software module view and the dynamic software module view in the common subspace Where S(i) represents the sample features of the static software module view, and D(j) represents the sample features of the dynamic software module view;

[0024] The value 1 indicates that the sample category is defective, and the value 0 indicates that the sample category is non-defective. Samples composed of the same metric elements and the same sample category belong to the same type of view, and samples composed of the same metric elements and different sample categories belong to different types of views;

[0025] Constructing the loss function L for inter-view discriminative analysis G:

[0026]

[0027] The function h(t)=max(0,t) represents the hinge loss function, γ is a pre-set hyperparameter, τ is a pre-set positive threshold, and l(.) represents the sample category. Represents the original sample of the static software module view, Represents the original sample of dynamic software module view.

[0028] Preferably, the adversarial loss function for distinguishing different software module views in a common subspace is constructed by adversarial learning, comprising the steps of:

[0029] Building a static software module view discriminator in a common subspace and dynamic software module view discriminator

[0030] The view features of the static software module view are used as real samples, and the view features of the dynamic software module view are used as generated samples. The adversarial loss function based on the static software module view is established: Where Pdata is the view feature of the static software module view in the public subspace, PG is the view feature of the dynamic software module view in the public subspace, View discriminator for static software modules The network parameters, E x~Pdata Represents the data distribution of the static software module view, Data distribution representing dynamic software module views;

[0031] The view features of dynamic software module views are used as real samples, and the view features of static software modules are used as generated samples. The adversarial loss function based on dynamic software module views is established: in A view discriminator for dynamic software modules Network parameters;

[0032] According to the adversarial loss function based on the static software module view and the adversarial loss function based on the dynamic software module view, the discriminant loss function of the adversarial network is obtained:

[0033] Preferably, the third network model is constructed according to the first network model and the second network model by combining the inter-view discrimination analysis loss function L of the first network model. G The discriminant loss function L of the adversarial network of the second network model D (θ D), and the minimax game strategy is used for training, which can be expressed as: and The stochastic gradient descent optimization algorithm is used to obtain the third network model parameters.

[0034] Preferably, the step of inputting the multi-view software test data into the third network model to obtain the prediction result comprises the steps of:

[0035] Inputting the multi-view software test data into the third network model to obtain sample features;

[0036] Input sample features into the classifier;

[0037] The classifier outputs the classification result based on the sample features, which is the prediction result.

[0038] A computer-readable storage medium stores a computer program for electronic data exchange, wherein when the computer program is executed by a processor, the computer executes the above method.

[0039] A multi-view software defect prediction system based on adversarial learning, characterized by comprising:

[0040] Input and output devices;

[0041] processor;

[0042] Memory;

[0043] as well as

[0044] One or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the processor, the programs causing the computer to perform the above method.

[0045] The method and system of the present invention have the advantages that:

[0046] (1) By using the nonlinear features in the deep metric learning constraint subspace, we design the inter-view discriminant analysis loss function, which makes different samples between the same views compact and different samples between different views far away from each other, improves the inter-view discriminant analysis capability, and effectively mines the structural relationship of the data between views.

[0047] (2) Construct a discriminator. Through adversarial learning, an adversarial loss function is constructed to distinguish different software module views in a common subspace. Given a feature projection on an unknown common subspace, the discriminator can effectively discriminate and distinguish static software module view features from dynamic software module view features.

[0048] (3) By constructing the overall network based on the inter-view discrimination analysis loss function and the adversarial loss function, the structural relationship of the inter-view data can be mined while maintaining the feature structure, thereby effectively enhancing the discrimination ability of the network model and improving the classification prediction performance and the accuracy of the prediction results. BRIEF DESCRIPTION OF THE DRAWINGS

[0049] Figure 1 This is a flow chart of a multi-view software defect prediction method based on adversarial learning according to an embodiment of the present invention.

[0050] Figure 2 It is a structural diagram of a multi-view software defect prediction system based on adversarial learning. DETAILED DESCRIPTION

[0051] The present invention is described in detail below in conjunction with specific embodiments. The following embodiments will help those skilled in the art to further understand the invention, but are not intended to limit the present invention in any form. It should be noted that, for those of ordinary skill in the art, several changes and improvements can be made without departing from the concept of the present invention. These all belong to the protection scope of the present invention.

[0052] An embodiment of multi-view software defect prediction based on adversarial learning of the present invention is shown in the flowchart as follows: Figure 1 As shown, it is characterized by comprising:

[0053] Constructing a first network model according to the multi-view software module sample data, wherein the first network model constructs an inter-view discriminant analysis loss function for distinguishing between similar views and heterogeneous views through deep metric learning;

[0054] Constructing a second network model according to the multi-view software module sample data, wherein the second network model is an adversarial loss function constructed by adversarial learning for distinguishing different software module views in a common subspace;

[0055] Constructing a third network model according to the first network model and the second network model;

[0056] The multi-view software test data is input into the third network model to obtain the prediction result.

[0057] In a preferred embodiment, before constructing the first network model according to the multi-view software module sample data, the following steps are further included:

[0058] Normalize the metrics of the multi-view software module;

[0059] The normalized sample data of the multi-view software module are nonlinearly projected into the common subspace.

[0060] In a preferred embodiment, the normalizing the metric elements of the multi-view software module comprises the steps of:

[0061] Any software module sample in the software warehouse is represented as a static software module view composed of static metric elements and a dynamic software module view composed of dynamic metric elements; the static metric elements represent the attribute information counted after the project development is completed and finalized, and the dynamic metric elements represent the attribute information recorded during the development process;

[0062] The min-max normalization method is used to put the metrics in the static software module view and the dynamic software module view in the same dimension, that is, in the interval [0,1].

[0063] In this embodiment, any software module sample v in the software warehouse i Expressed as The vector composition of the joint representation is Corresponding sample v i The static software module view consists of static metrics. Corresponding sample v i The dynamic software module view is composed of dynamic metrics. The min-max normalization method is used to make and The metric elements are in the same dimension, that is, the interval [0,1], to achieve the normalization of the sample metric elements.

[0064] In a preferred embodiment, the nonlinear projection of the normalized sample data of the multi-view software module to the common subspace comprises the steps of:

[0065] Extracting Initial Features of Static Software Module Views from Static Software Module View Dataset Extracting initial features of dynamic software module views from dynamic software module view dataset

[0066] Construct a dual-channel network with parameter sharing;

[0067] Static software module view initial features Input four-layer FNN network to obtain static software module view specific features Dynamic software module view initial features Input four-layer FNN network to obtain dynamic software module view specific features in A four-layer FNN network mapping function representing a static software module view, Four-layer FNN network mapping function representing the dynamic software module view, Shared network parameters θ FNN .

[0068] In this embodiment, from the static software module view data set Extract the corresponding static software module view initial features and dynamic software module view initial features from View datasets from dynamic software modules Extract the corresponding static software module view initial features and dynamic software module view initial features from

[0069] Construct a dual-channel network with parameter sharing, and the shared network parameters are recorded as θ FNN ;

[0070] Initial features based on static software module view Four-layer FNN network mapping function with static software module view Computing specific features of static software module views

[0071] Initial features based on dynamic software module view Four-layer FNN network mapping function with dynamic software module view Computing specific features of dynamic software module views

[0072] In a preferred embodiment, the constructing of the inter-view discriminant analysis loss function for distinguishing the same type of views from different types of views by deep metric learning comprises the steps of:

[0073] Calculate the distance between the corresponding sample features of the static software module view and the dynamic software module view in the common subspace Where S(i) represents the sample features of the static software module view, and D(j) represents the sample features of the dynamic software module view;

[0074] The value 1 indicates that the sample category is defective, and the value 0 indicates that the sample category is non-defective;

[0075] Constructing the loss function L for inter-view discriminative analysis G :

[0076]

[0077] The function h(t)=max(0,t) represents the hinge loss function, γ is a pre-set hyperparameter, τ is a pre-set positive threshold, and l(.) represents the sample category. Represents the original sample of the static software module view, Represents the original sample of dynamic software module view.

[0078] In this embodiment, deep metric learning is used to constrain the nonlinear features in the subspace, and the loss function of discriminant analysis between views is designed to achieve compactness of different samples between the same type of views and distance between different samples between different types of views, thereby improving the discriminant analysis capability between views. Among the original samples of the static software module view and the dynamic software module view, samples composed of the same metric element and the same sample category belong to the same type of view, and samples composed of the same metric element and different sample categories belong to different types of views.

[0079] According to the L2 paradigm, the distance between any two sample features corresponding to the static software module view and the dynamic software module view in the common subspace is calculated as:

[0080]

[0081] In the above formula (1), S(i) represents the sample features of the static software module view, and D(j) represents the sample features of the dynamic software module view. is the sample features mapped in the common subspace of the static software module view, Sample features mapped in a common subspace for dynamic software module views;

[0082] l(.) is used to represent the sample category, which is divided into defective (represented by 1) and non-defective (represented by 0);

[0083] Constructing the loss function L for inter-view discriminative analysis G :

[0084]

[0085] In the above formula (2), the function h(t) = max(0, t) represents the hinge loss function, γ is a pre-set hyperparameter, and τ is a pre-set positive threshold. Represents the original sample of the static software module view, Represents the original sample of dynamic software module view.

[0086] In a preferred embodiment, the adversarial loss function for distinguishing different software module views in a common subspace through adversarial learning comprises the steps of:

[0087] Building a static software module view discriminator in a common subspace and dynamic software module view discriminator

[0088] The view features of the static software module view are used as real samples, and the view features of the dynamic software module view are used as generated samples. The adversarial loss function based on the static software module view is established: Where Pdata is the view feature of the static software module view in the public subspace, PG is the view feature of the dynamic software module view in the public subspace, View discriminator for static software modules The network parameters, E x~Pdata Represents the data distribution of the static software module view, Data distribution representing dynamic software module views;

[0089] The view features of dynamic software module views are used as real samples, and the view features of static software modules are used as generated samples. The adversarial loss function based on dynamic software module views is established: in A view discriminator for dynamic software modules Network parameters;

[0090] According to the adversarial loss function based on the static software module view and the adversarial loss function based on the dynamic software module view, the discriminant loss function of the adversarial network is obtained:

[0091] In this embodiment, a static software module view discriminator in a common subspace is constructed. and dynamic software module view discriminator Given a feature projection on an unknown common subspace, try to identify whether it is a static software module view feature or a dynamic software module view feature;

[0092] The view features of the static software module view are used as real samples, and the view features of the dynamic software module view are used as generated samples. The adversarial loss function based on the static software module view is established:

[0093]

[0094] In the above formula (3), Pdata is the view feature of the static software module view in the public subspace, PG is the view feature of the dynamic software module view in the public subspace, View discriminator for static software modules The network parameters, E x~Pdata Represents the data distribution of the static software module view, Data distribution representing dynamic software module views;

[0095] The view features of dynamic software module views are used as real samples, and the view features of static software modules are used as generated samples. The adversarial loss function based on dynamic software module views is established:

[0096]

[0097] In the above formula (4) A view discriminator for dynamic software modules Network parameters;

[0098] Combining formula (3) and formula (4), we get the discriminant loss function of the adversarial network:

[0099]

[0100] In a preferred embodiment, the third network model is constructed based on the first network model and the second network model by combining the inter-view discrimination analysis loss function L of the first network model. G The discriminant loss function L of the adversarial network of the second network model D (θ D ), and the minimax game strategy is used for training, which can be expressed as: and The stochastic gradient descent optimization algorithm is used to obtain the third network model parameters.

[0101] In this embodiment, the third network model is composed of a generative model and a discriminative model, and the corresponding loss functions, namely, formula (2) and formula (5), are combined and trained using a minimax game strategy, which is expressed as:

[0102]

[0103]

[0104] Among them, the third network model parameters are obtained using the stochastic gradient descent optimization algorithm.

[0105] In a preferred embodiment, the multi-view software test data is input into the third network model to obtain the prediction result, comprising the steps of:

[0106] Inputting the multi-view software test data into the third network model to obtain sample features;

[0107] Input sample features into the classifier;

[0108] The classifier outputs the classification result based on the sample features, which is the prediction result.

[0109] In this embodiment, multi-view software test data is input into the third network model, sample features are calculated, and the sample features are input into a pre-set classifier, such as a softmax classifier. The classifier outputs a classification result (defective, non-defective) according to the sample features, which is the prediction result.

[0110] The beneficial effects of the present invention are described below in conjunction with specific experiments.

[0111] The present invention conducts experiments on the widely used software defect prediction public test dataset AEEEM. Table 1 lists the items included in the AEEEM dataset, the number of samples of each item, the proportion of defective samples, the number of metrics, and other information.

[0112] Table 1 AEEEM dataset

[0113] Project Name Number of samples Proportion of defective samples (%) Number of metrics EQ 324 39.81 61 JDT 997 20.66 61 LC 691 9.26 61 ML 1862 13.16 61 PDE 1497 13.96 61

[0114] The static metric set in the AEEEM dataset is first constructed according to the attribute information counted after the project is finalized, such as LOC (Lines of Code), FANIN (Number of Input Data), etc. The dynamic metric set is constructed according to the attribute information recorded during the development process, such as NREV (Number of revisions), DELETELOC (Lines deleted), etc. The full name information of each project in the AEEEM dataset is: EQ for Equinox Framework, JDT for EclipseJDTCore, LC for ApacheLucene, ML for Mylyn, and PDE for EclipsePDEUI.

[0115] In this experiment, two widely used indicators in software defect prediction technology, F-measure and G-measure, are still used to evaluate the performance of the model. F-measure and G-measure are calculated using the following formulas:

[0116] F-measure=2*pd*precision / (pd+precision) (8)

[0117] G-measure=(2*pd*specificity) / (pd+specificity) (9)

[0118] Among them, the recall (pd) statistical measure is defined as TP / (TP+FN), TP represents True Positive, and FN represents False Negative; the precision (Pre) statistical measure is defined as TP / (TP+FP), and FP represents False Positive. G-measure takes into account both recall and specificity, and is the geometric mean of recall and specificity. Specificity is a statistical indicator defined as TN / (TN+FP), where TN represents True Negative. The larger the F-measure, the better the performance of cross-project defect prediction.

[0119] In order to evaluate the performance of the present invention, the following methods are selected for comparison, namely: (1) the deep canonical correlation analysis (DCCA) method in the document “Multi-view perceptron: a deep model for learning face identity and view representations” (author Zhou Z, etc.); (2) the NN-filter method in the document “On the relative value of cross-company and within-company data for defect prediction” (author Turhan B, etc.); (3) the multi-view deep network (MvDN) method in the document “Multi-view deep network for cross-view classification” (author Kan MN, etc.).

[0120] In order to solve the randomness of instance selection, 5 experiments were randomly conducted. Finally, the mean F-measure and G-measure of each test item are reported, as shown in Tables 2 and 3. As can be seen from Table 2, the prediction performance of the present invention is better than that of DCCA, NN-filter, and MvDN methods. The main reasons are as follows: the DCCA method does not pay much attention to the mining of identification information between views; the NN-filter connects different views in series and then classifies them during the experiment, and does not pay much attention to the connection between views; compared with the MvDA method, the present invention performs feature learning on software modules, and at the same time uses adversarial networks to extract effective identification features of views, which can more deeply mine the high-level semantic features of views. Therefore, the prediction performance of the present invention is better than the comparison method, and it is an effective software defect feature learning method.

[0121] Table 2 Average F-measure values ​​of the present invention and the comparative method on each project

[0122]

[0123] Table 3 Average G-measure values ​​of the present invention and the comparative method in each project

[0124]

[0125] A computer-readable storage medium stores a computer program for electronic data exchange, wherein when the computer program is executed by a processor, the computer executes the above method.

[0126] A multi-view software defect prediction system based on adversarial learning according to an embodiment of the present invention is shown in the structural diagram as follows: Figure 2 As shown, it is characterized by comprising:

[0127] Input and output devices;

[0128] processor;

[0129] Memory;

[0130] as well as

[0131] One or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the processor, the programs causing the computer to perform the above method.

[0132] Of course, those skilled in the art should realize that the above embodiments are only used to illustrate the present invention, and are not intended to limit the present invention. As long as they are within the scope of the present invention, any changes or modifications to the above embodiments will fall within the protection scope of the present invention.

Claims

1. A multi-view software defect prediction method based on adversarial learning, characterized in that: include: Normalize the metrics of the multi-view software module; The method of normalizing the metrics of the multi-view software module comprises the steps of representing any software module sample in the software warehouse as a static software module view composed of static metrics and a dynamic software module view composed of dynamic metrics; the static metrics represent the attribute information counted after the project is developed and finalized, and the dynamic metrics represent the attribute information recorded during the development process; and the metrics in the static software module view and the dynamic software module view are in the same dimension, i.e., in the interval [0,1], by using the min-max normalization method; Nonlinearly projecting the normalized sample data of the multi-view software module into a common subspace; A first network model is constructed according to the multi-view software module sample data, wherein the first network model is an inter-view discriminant analysis loss function constructed by deep metric learning for distinguishing views of the same type from views of different types; a second network model is constructed according to the multi-view software module sample data, wherein the second network model is an adversarial loss function constructed by adversarial learning for distinguishing views of different software modules in a common subspace; Constructing a third network model according to the first network model and the second network model; the third network model is composed of a generative model and a discriminative model, and is trained by using a minimax game strategy in conjunction with a corresponding loss function; The multi-view software test data is input into the third network model to obtain the prediction results.

2. The multi-view software defect prediction method based on adversarial learning according to claim 1, characterized in that: The nonlinearly projecting the normalized sample data of the multi-view software module to the common subspace comprises the steps of: Extracting Initial Features of Static Software Module Views from Static Software Module View Dataset Extracting initial features of dynamic software module views from dynamic software module view dataset Construct a dual-channel network with parameter sharing; Static software module view initial features Input four-layer FNN network to obtain static software module view specific features Dynamic software module view initial features Input four-layer FNN network to obtain dynamic software module view specific features in A four-layer FNN network mapping function representing a static software module view, Four-layer FNN network mapping function representing the dynamic software module view, Shared network parameters θ FNN .

3. The multi-view software defect prediction method based on adversarial learning according to claim 2, characterized in that: The method of constructing an inter-view discriminative analysis loss function for distinguishing similar views from heterogeneous views through deep metric learning comprises the following steps: Calculate the distance between the corresponding sample features of the static software module view and the dynamic software module view in the common subspace Where S(i) represents the sample features of the static software module view, and D(j) represents the sample features of the dynamic software module view; The value 1 indicates that the sample category is defective, and the value 0 indicates that the sample category is non-defective; Constructing the loss function L for inter-view discriminative analysis G : The function h(t)=max(0,t) represents the hinge loss function, γ is a pre-set hyperparameter, τ is a pre-set positive threshold, and l(.) represents the sample category. Represents the original sample of the static software module view, Represents the original sample of dynamic software module view.

4. The multi-view software defect prediction method based on adversarial learning according to claim 3, characterized in that: The method of constructing an adversarial loss function for distinguishing different software module views in a common subspace through adversarial learning comprises the following steps: Building a static software module view discriminator in a common subspace and dynamic software module view discriminator The view features of the static software module view are used as real samples, and the view features of the dynamic software module view are used as generated samples. The adversarial loss function based on the static software module view is established: Where Pdata is the view feature of the static software module view in the public subspace, PG is the view feature of the dynamic software module view in the public subspace, View discriminator for static software modules The network parameters, E x~Pdata Represents the data distribution of the static software module view, Data distribution representing dynamic software module views; The view features of dynamic software module views are used as real samples, and the view features of static software modules are used as generated samples. An adversarial loss function based on dynamic software module views is established: in A view discriminator for dynamic software modules Network parameters; According to the adversarial loss function based on the static software module view and the adversarial loss function based on the dynamic software module view, the discriminant loss function of the adversarial network is obtained:

5. The multi-view software defect prediction method based on adversarial learning according to claim 4, characterized in that: The third network model constructed according to the first network model and the second network model is a view-to-view discrimination analysis loss function L of the first network model. G The discriminant loss function L of the adversarial network of the second network model D (θ D ), and the minimax game strategy is used for training, which can be expressed as: and The stochastic gradient descent optimization algorithm is used to obtain the third network model parameters.

6. The multi-view software defect prediction method based on adversarial learning according to claim 1, characterized in that: The step of inputting the multi-view software test data into the third network model to obtain the prediction result comprises the following steps: Inputting the multi-view software test data into the third network model to obtain sample features; Input sample features into the classifier; The classifier outputs the classification result based on the sample features, which is the prediction result.

7. A computer-readable storage medium storing a computer program for electronic data exchange, wherein: The computer program enables a computer to execute the method according to any one of claims 1 to 6.

8. A multi-view software defect prediction system based on adversarial learning, characterized in that include: Input and output devices; processor; Memory; as well as One or more programs, wherein the one or more programs are stored in a memory and configured to be executed by the processor, the programs causing the computer to execute the method according to any one of claims 1 to 6.

Citation Information

Patent Citations

  • Software defect prediction method based on deep migration

    CN110162475A

  • Deep learning cross-project software defect prediction method based on GAN network

    CN113419948A

  • Method for generating super-resolution image based on generative adversarial network

    CN110490804A

  • Heterogeneous cross-project software defect prediction method based on nuclear spectrum mapping migration integration

    CN110659207A