Supervised multi-view software defect prediction method and system based on autoencoder
Through the supervised multi-view software defect prediction method based on the autoencoder, the identification information and correlation information of the multi-view software module are used to solve the problem of low single-view prediction performance and achieve more efficient software defect prediction.
Patent Information
- Application Number
- CN202111365881.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-17
- Publication Date
- 2025-05-02
- Estimated Expiration
- 2041-11-17
AI Technical Summary
The existing software defect prediction technology is mainly based on single view, and it is impossible to fully mine the identification information and correlation information in the multi-view software module sample, resulting in low prediction performance and result accuracy.
A supervised multi-view software defect prediction method based on an autoencoder is proposed. The identification information and correlation information of the multi-view software module are extracted and utilized by constructing multiple network models to minimize the reconstruction loss terms, intra-class divergence matrix and inter-class divergence matrix, and inter-view correlation loss function.
Through the effective utilization of multi-view information, the performance and result accuracy of software defect prediction are significantly improved, and software defects can be predicted more accurately.
Smart Images

Figure CN114371987B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of software defect prediction, and in particular to a supervised multi-view software defect prediction method and system based on an autoencoder. Background Art
[0002] With the vigorous development of computer science, artificial intelligence and other technologies, today's society has entered the era of big data, and various types of software used in daily life, such as video software, office software, e-commerce software, etc., are developing rapidly. In order to ensure the quality of software, the use of software defect prediction technology before the official release of the software can better improve and ensure the quality of software products.
[0003] At present, some studies have tried to apply deep learning to project defect prediction (WPDP) and cross-project defect prediction (CPDP). For example, the Chinese patent "A software defect prediction method based on deep migration" with publication number CN108459955A proposes to collect the source code files of the software to be predicted through version control tools; the obtained source code files are composed of I modules, and the metric values are extracted from the source code files, and all metric values constitute a set; the set is preprocessed; the sampling result set is obtained through the metric value selection module by sampling; the deep autoencoder network builds a prediction model; the version to be predicted is predicted and the prediction result is output. The prediction method proposed in the Chinese patent "A cross-project software defect prediction method based on supervised representation learning" with publication number CN110751186A includes the following steps: selecting a defect data set and preprocessing the defect data; training the transfer autoencoder in an unsupervised pre-training manner, the transfer autoencoder including a feature encoding layer and a label encoding layer; using the transfer cross-validation method, selecting samples closest to the hidden feature distribution of the target project samples from the hidden feature representation of all samples of the source project as the validation set, and the rest as the training set; oversampling the training set samples; fine-tuning the transfer autoencoder, selecting model hyperparameters and early stopping strategies; inputting the preprocessed data of the target project into the transfer autoencoder, and obtaining the final prediction result from the output of the label encoding layer.
[0004] The above software defect prediction technologies are all based on a single view, and the metric elements are concatenated as a sample set for feature learning. However, a single view can often only reflect information about a certain aspect of an object. Classification and prediction based on the information of a single view have low prediction performance and result accuracy.
[0005] At present, there is no supervised multi-view software defect deep learning model based on the characteristics of multi-view software module samples, which can fully exploit the identification information in the static software module view, the identification information in the dynamic software module view, and the useful correlation information between static and dynamic views, and efficiently extract identification features to improve the prediction performance of the software defect prediction model. To this end, a supervised multi-view software defect prediction method based on autoencoder is proposed. Summary of the invention
[0006] In order to solve the above problems, the present invention proposes a supervised multi-view software defect prediction method and system based on an autoencoder.
[0007] A supervised multi-view software defect prediction method based on an autoencoder 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 is constructed by minimizing the reconstruction loss term to obtain a specific autoencoder network for different software module views;
[0009] Constructing a second network model according to the multi-view software module sample data, wherein constructing the second network model is to construct an intra-view discrimination loss function for identifying intra-view discrimination information through an intra-class scatter matrix and an inter-class scatter matrix;
[0010] Constructing a third network model according to the first network model; constructing the third network model is to construct a correlation loss function between views according to the correlation structure information between the encoding features of different software module views of the first network model.
[0011] Constructing a fourth network model according to the first network model, the second network model and the third network model;
[0012] The multi-view software test data is input into the fourth network model to obtain the prediction result.
[0013] Preferably, before constructing the first network model according to the multi-view software module sample data, the method further includes the following steps:
[0014] Using a single metric to represent data from different software module views;
[0015] Normalize single metric datasets from different software module views.
[0016] Preferably, the method of using a single metric to represent data of different software module views comprises the steps of:
[0017] Any software module sample in the software warehouse v i According to the static measurement and dynamic measurement, they are expressed as and
[0018] Defining static software module viewsets The single metric representation of is: in represents a collection of metrics shared by static software module views, Represents a view-specific set of metrics, 0 (S) A zero matrix representing a static software module view;
[0019] Defining dynamic software module viewsets The single metric representation of is: in A collection of metrics that represent the shared view of a dynamic software module. Represents a set of metrics specific to a dynamic software module view. (D) A zero matrix representing a dynamic software module view.
[0020] Preferably, the normalization of the single metric data sets of different software module views is to use a min-max normalization method to normalize the single metric data sets of static software module views. Single metric dataset for dynamic software module views The values of each metric in are linearly transformed to the interval [0,1].
[0021] Preferably, the specific autoencoder network for obtaining different software module views by minimizing the reconstruction loss term comprises the steps of:
[0022] Building Static View Autoencoder StaNet auto , StaNet auto The network parameters are
[0023] The normalized static software module view single metric dataset Enter StaNet auto Network, Output where f (S) Representing StaNet auto The mapping function of the network, M represents the number of network layers;
[0024] A specific network encoding function that constructs a static software module view by minimizing the reconstruction error loss term:
[0025]
[0026] Building a Dynamic View Autoencoder DiaNet auto , DiaNet auto The network parameters are
[0027] The normalized dynamic software module view single metric dataset Enter DiaNet auto Network, Output f (D) Representing DiaNet auto The mapping function of the network;
[0028] A specific network encoding function that constructs a dynamic software module view by minimizing the reconstruction error loss term:
[0029]
[0030] Preferably, constructing the intra-view discrimination loss function for identifying intra-view discrimination information by using the intra-class scatter matrix and the inter-class scatter matrix comprises the steps of:
[0031] The encoding feature set output by the specific network coding function of the static software module view is denoted as F (S) =F (M / 2,S) , M / 2 represents the number of coding layers; the coding feature set output by the specific network coding function of the dynamic software module view is recorded as F (D) =F (M / 2,D) ;
[0032] Let the network parameters of the static view autoencoder be and the network parameters of the dynamic view autoencoder Consistent, denoted as θ;
[0033] Compute the intra-class scatter matrix
[0034] Among them, c = 0 means that the sample category is defect-free, and c = 1 means that the sample category is defective. represents the mean value of the c-th class of static software view samples, represents the mean of the c-th type of dynamic software view samples, n represents the number of samples, n c represents the number of samples in the cth category;
[0035] Compute the between-class scatter matrix
[0036] Among them, μ (S) represents the total mean of static software module samples, μ (D) represents the total mean of the dynamic software module samples;
[0037] Constructing the discriminative loss function within the view Where Tr(.) represents the trace of the matrix.
[0038] Preferably, constructing the inter-view correlation loss function according to the correlation structure information between the view encoding features of different software modules of the first network model comprises the steps of:
[0039] Define the correlation between the encoding features of static software module view and dynamic software module view as Rel(F (S) ,F (D) );
[0040] Construct the correlation loss function between the static software module view and the dynamic software module view: in
[0041] I represents the identity matrix, λ1 and λ2 are regularization parameters.
[0042] Preferably, the fourth network model is constructed according to the first network model, the second network model and the third network model, and the final network objective function is constructed according to the specific network coding function L(Sauto) of the static software module view, the specific network coding function L(Dauto) of the dynamic software module view, the identification loss function L(SDwithin) within the view and the correlation loss function L(SDBetween) between the views.
[0043]
[0044] Preferably, the step of inputting the multi-view software test data into the fourth network model to obtain the prediction result comprises the steps of:
[0045] Any test software sample data v test According to static measurement and dynamic measurement, it can be divided into and
[0046] Static view software test data and dynamic view software test data Input the fourth network model to obtain sample feature values;
[0047] Input sample feature values into the classifier;
[0048] The classifier outputs the classification result as a value of 0 or 1 according to the sample feature value. The value 0 indicates no defect, and the value 1 indicates a defect, which is the prediction result.
[0049] 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.
[0050] A supervised multi-view software defect prediction system based on autoencoder, characterized by comprising:
[0051] Input and output devices;
[0052] processor;
[0053] Memory;
[0054] as well as
[0055] 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.
[0056] The method and system of the present invention have the advantages that:
[0057] (1) Use a single metric to represent the data of different software module views and normalize them to enhance the correlation between different view data associated with the same sample.
[0058] (2) By minimizing the reconstruction loss term, specific autoencoder networks for different software module views are obtained, which can better utilize the complementary information between views to improve the identification performance of the model.
[0059] (3) The intra-view discriminant loss function for identifying the discriminant information within the view is constructed through the intra-class divergence matrix and the inter-class divergence matrix, so as to effectively mine the discriminant information within the software module view.
[0060] (4) The correlation loss function between views is constructed through the correlation structure information of the encoding features of different software module views, and the correlation analysis technology is used to effectively mine the useful correlation information between software module views.
[0061] (5) The final network objective function is constructed based on the specific network coding function of the static software module view, the specific network coding function of the dynamic software module view, the identification loss function within the view, and the correlation loss function between views. The final network objective function is used to predict software defects, which can effectively improve the performance and accuracy of software prediction results. BRIEF DESCRIPTION OF THE DRAWINGS
[0062] Figure 1 This is a flow chart of a supervised multi-view software defect prediction method based on an autoencoder according to an embodiment of the present invention.
[0063] Figure 2 It is a structural diagram of a supervised multi-view software defect prediction system based on autoencoder. DETAILED DESCRIPTION
[0064] 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.
[0065] An embodiment of the supervised multi-view software defect prediction based on an autoencoder of the present invention is shown in the flowchart as follows: Figure 1 As shown, it is characterized by comprising:
[0066] Constructing a first network model according to the multi-view software module sample data, wherein the first network model is constructed by minimizing the reconstruction loss term to obtain a specific autoencoder network for different software module views;
[0067] Constructing a second network model according to the multi-view software module sample data, wherein constructing the second network model is to construct an intra-view discrimination loss function for identifying intra-view discrimination information through an intra-class scatter matrix and an inter-class scatter matrix;
[0068] Constructing a third network model according to the first network model; constructing the third network model is to construct a correlation loss function between views according to the correlation structure information between the encoding features of different software module views of the first network model.
[0069] Constructing a fourth network model according to the first network model, the second network model and the third network model;
[0070] The multi-view software test data is input into the fourth network model to obtain the prediction result.
[0071] 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:
[0072] Using a single metric to represent data from different software module views;
[0073] Normalize single metric datasets from different software module views.
[0074] In a preferred embodiment, the method of using a single metric to represent data of different software module views comprises the steps of:
[0075] Any software module sample in the software warehouse v i According to the static measurement and dynamic measurement, they are expressed as and
[0076] Defining static software module viewsets The single metric representation of is: in represents a collection of metrics shared by static software module views, Represents a view-specific set of metrics, 0 (S) A zero matrix representing a static software module view;
[0077] Defining dynamic software module viewsets The single metric representation of is: in A collection of metrics that represent the shared view of a dynamic software module. Represents a set of metrics specific to a dynamic software module view. (D) A zero matrix representing a dynamic software module view.
[0078] In this embodiment, it is assumed that any software module sample v in the software warehouse i According to the static measurement and dynamic measurement, they are expressed as and in express The value of the jth metric in , ds represents the number of metrics of the static software module sample; express The value of the jth metric in , dd represents the number of metrics of the dynamic software module sample;
[0079] In order to enhance the correlation between different view data associated with the same sample, static software module view sets are defined separately. and dynamic software module viewsets The single metric (UMR) is expressed as:
[0080]
[0081] in, Represents a collection of metrics shared by views. Represents a view-specific set of metrics. is the 0 matrix of the static software module view, is the 0 matrix of the dynamic software module view, and T represents the transpose of the matrix (a matrix term that will not be repeated in subsequent formulas).
[0082] In a preferred embodiment, the normalization of the single metric data sets of different software module views is to use a min-max normalization method to normalize the single metric data sets of static software module views. Single metric dataset for dynamic software module views The values of each metric in are linearly transformed to the interval [0,1]. In this embodiment, since and The metric values used in the view dataset are usually not in the same dimension. Here, the min-max normalization method is used to linearly convert the values of each metric element into a dimensionless expression, that is, all metric values are converted to the [0,1] interval.
[0083] In a preferred embodiment, the specific autoencoder network for obtaining different software module views by minimizing the reconstruction loss term comprises the steps of:
[0084] Building Static View Autoencoder StaNet auto , StaNet auto The network parameters are
[0085] The normalized static software module view single metric dataset Enter StaNet auto Network, Output where f (S) Representing StaNet auto The mapping function of the network, M represents the number of network layers;
[0086] A specific network encoding function that constructs a static software module view by minimizing the reconstruction error loss term:
[0087]
[0088] Building a Dynamic View Autoencoder DiaNet auto , DiaNet auto The network parameters are
[0089] The normalized dynamic software module view single metric dataset Enter DiaNet auto Network, Output f (D) Representing DiaNet auto The mapping function of the network;
[0090] A specific network encoding function that constructs a dynamic software module view by minimizing the reconstruction error loss term:
[0091]
[0092] In this embodiment, for the static software module view, a static view autoencoder StaNet is constructed auto Digging High-level semantic features of view data, StaNet auto The network parameters are represents the parameters of the mth layer network, and M represents the number of layers of the network. Assume that the network mapping function of the static view autoencoder network is f (S) , then the normalized static software module view single metric dataset Enter StaNet auto Network, Output A specific network encoding function that constructs a static software module view by minimizing the reconstruction error loss term:
[0093]
[0094] Similarly, for dynamic software module views, we construct a dynamic view autoencoder DiaNet auto Digging High-level semantic features of view data, DiaNet auto The network parameters are represents the parameters of the mth layer network, and M represents the number of layers of the network. Assume that the mapping function of the dynamic view autoencoder network is f (D) , the normalized dynamic software module view single metric dataset Enter DiaNet auto Network, Output A specific network encoding function that constructs a dynamic software module view by minimizing the reconstruction error loss term:
[0095]
[0096] In a preferred embodiment, the intra-view discrimination loss function for identifying intra-view discrimination information is constructed by using the intra-class scatter matrix and the inter-class scatter matrix, comprising the steps of:
[0097] The encoding feature set output by the specific network coding function of the static software module view is denoted as F (S) =F (M / 2,S) , M / 2 represents the number of coding layers; the coding feature set output by the specific network coding function of the dynamic software module view is recorded as F (D) =F (M / 2,D) ;
[0098] Let the network parameters of the static view autoencoder be and the network parameters of the dynamic view autoencoder Consistent, denoted as θ;
[0099] Compute the intra-class scatter matrix
[0100] Among them, c = 0 means that the sample category is defect-free, and c = 1 means that the sample category is defective. represents the mean value of the c-th class of static software view samples, represents the mean of the c-th type of dynamic software view samples, n represents the number of samples, n c represents the number of samples in the cth category;
[0101] Compute the between-class scatter matrix Among them, μ (S) represents the total mean of static software module samples, μ (D) represents the total mean of the dynamic software module samples;
[0102] Constructing the discriminative loss function within the view Where Tr(.) represents the trace of the matrix.
[0103] In this embodiment, in order to reduce the impact of view data distribution differences on feature learning, the network parameters of the static view autoencoder are set to and the network parameters of the dynamic view autoencoder Consistent, that is
[0104] Calculate the intra-class scatter matrix S W :
[0105]
[0106] Among them, c = 0 means that the sample category is defect-free, and c = 1 means that the sample category is defective. represents the mean value of the c-th class of static software view samples, represents the mean of the c-th type of dynamic software view samples, n represents the number of samples, n c Represents the number of samples in the cth category.
[0107] Since the identification loss function is calculated using the gradient descent method, formula (5) needs to be rewritten as:
[0108]
[0109] Where I is the identity matrix, and is a vector of dimension n, and when the i-th sample belongs to the c-th class,
[0110] Calculate the inter-class scatter matrix S B :
[0111]
[0112] Among them, μ (S) represents the total mean of static software module samples, μ (D)Represents the total mean of dynamic software module samples. Since the identification loss function is calculated using the gradient descent method, formula (7) needs to be rewritten as:
[0113]
[0114] Among them, e (S) and e (D) Represents a vector of all ones with dimension n.
[0115] Based on formulas (6) and (8), the intra-view discrimination loss function L(SD within )for:
[0116]
[0117] In a preferred embodiment, the method of constructing a correlation loss function between views based on the correlation structure information between the encoding features of different software module views of the first network model comprises the steps of:
[0118] Define the correlation between the encoding features of static software module view and dynamic software module view as Rel(F (S) ,F (D) );
[0119] Construct the correlation loss function between the static software module view and the dynamic software module view: in
[0120] I represents the identity matrix, λ1 and λ2 are regularization parameters.
[0121] In this embodiment, Rel(F (S) ,F (D) ) represents the correlation between the encoding features of the two views, and is the network parameter and Construct the correlation loss function between the static software module view and the dynamic software module view:
[0122]
[0123] in, They are defined as:
[0124]
[0125] I represents the identity matrix, λ1 and λ2 are regularization parameters.
[0126] Preferably, the fourth network model is constructed according to the first network model, the second network model and the third network model, and the final network objective function is constructed according to the specific network coding function L(Sauto) of the static software module view, the specific network coding function L(Dauto) of the dynamic software module view, the identification loss function L(SDwithin) within the view and the correlation loss function L(SDBetween) between the views.
[0127]
[0128] In this embodiment, based on formula (3), L(S auto ), L(D auto ), L(SD within ) and L(SDBetween) of formula (10), and establish the final network objective function L(θ)==L(SDBetween)-L(SDwithin)-L(Sauto)-L(Dauto), that is
[0129]
[0130] In a preferred embodiment, the step of inputting the multi-view software test data into the fourth network model to obtain the prediction result comprises the following steps:
[0131] Any test software sample data v test According to static measurement and dynamic measurement, it can be divided into and
[0132] Static view software test data and dynamic view software test data Input the fourth network model to obtain sample feature values;
[0133] Input sample feature values into the classifier;
[0134] The classifier outputs the classification result as a value of 0 or 1 according to the sample feature value. The value 0 indicates no defect, and the value 1 indicates a defect, which is the prediction result.
[0135] In this embodiment, any test software sample data v test According to static measurement and dynamic measurement, it can be divided into and Static view software test data and dynamic view software test data The fourth network model is input to obtain the sample feature value, and the sample feature is input into a pre-set classifier, such as a softmax classifier. The classifier outputs a classification result as a value of 0 or a value of 1 according to the sample feature. The value 0 indicates no defect, and the value 1 indicates a defect, which is the prediction result.
[0136] The beneficial effects of the present invention are described below in conjunction with specific experiments.
[0137] The present invention conducts experiments on the widely used software defect prediction public test dataset AEEEM. Table 1 lists the specific information of the AEEEM dataset:
[0138] Table 1 Dataset information
[0139]
[0140] 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. The 61 metrics include LOC (Lines of Code), FANIN (Number of Input Data), NREV (Number of revisions), DELETELOC (Lines deleted), etc. The original attributes of each sample in the AEEEM dataset are composed of these 61 metrics. Then, according to the attribute information counted after the project development is completed and the attribute information recorded during the development process, the static software module view set and the dynamic software module view set are constructed respectively.
[0141] In the field of software defect prediction, the following two indicators are often used to evaluate the model: F1 and AUC. F-measure is a harmonic mean measure that balances pd and precision, ranging from 0 to 1 and reaching the best value at 1 (from worst to best); AUC calculates the area under the receiver operating characteristic (ROC) curve, ranging from 0 to 1.
[0142] The F-measure is calculated using the following formula:
[0143] F-measure=2*pd*precision / (pd+precision) (15)
[0144] The recall (pd) statistic is defined as TP / (TP+FN), where TP stands for True Positive and FN stands for False Negative. The precision (Pre) statistic is defined as TP / (TP+FP), where FP stands for False Positive. The larger the F-measure, the better the performance of cross-project defect prediction.
[0145] In order to evaluate the performance of the present invention, two single-view learning methods and a multi-view learning method are selected for comparison. The single-view feature learning method is: (1) the multidimensional scaling analysis method (MDS) in the document "A review of multidimensional Scaling (MDS) and its utility in various psychological domains" (author Jaworska N); (2) the transfer component analysis (TCA) method in the document "Transfer defect learning" (author Nam J et al.). The multi-view feature learning method is: (1) the canonical correlation analysis (CCA) method in the document "Canonical correlation analysis: an overview with application to learning methods" (author Hardoon DR et al.); (2) the multi-view deep network (MvDN) method in the document "Multi-view deep network for cross-view classification" (author Kan MN et al.).
[0146] In order to solve the randomness of instance selection, 5 experiments were randomly performed. Parameters λ1=0.1, λ2=0.5, the number of initialization iterations is k=100, the batch size m=256, and the view dataset is divided into training batches. The number of iterations of the discriminator n_num=10 for each iteration of the generator. The truncation parameter c=0.01, and the learning rate r=0.001. Finally, the mean F-measure and AUC mean of each test item are reported, as shown in Tables 2 and 3. It can be seen from Table 2 that the prediction performance of the present invention is better than that of the four comparison methods. The main reasons are as follows:
[0147] (1) Compared with the single-view learning methods MDS and TCA, the present invention formally divides the data into static software module views and dynamic software module views, avoiding the disadvantage of high redundancy of original data when directly connected in series for learning; in addition, both MDS and TCA learn on the concatenated feature vectors and cannot utilize the complementary information of data between views;
[0148] (2) Compared with the multi-view feature learning method CCA, which is an unsupervised multi-view subspace learning method, it fails to fully utilize the category information of multi-view software module samples to effectively mine the discriminative features of the data; the MvDN method jointly learns an independent discriminative projection transformation for each view. However, this method does not consider the typical correlation information contained in the multi-view data.
[0149] Table 2 Average F-measure values of the present invention and the comparative method in each project
[0150] MDS TCA CCA MvD The present invention EQ 0.217 0.402 0.521 0.540 0.649 JDT 0.154 0.362 0.403 0.437 0.470 LC 0.150 0.305 0.361 0.389 0.421 ML 0.141 0.302 0.369 0.400 0.444 PDE 0.200 0.279 0.321 0.348 0.399
[0151] Table 3 Average AUC values of the present invention and the comparative method in each project
[0152] MDS TCA CCA MvD The present invention EQ 0.437 0.587 0.702 0.731 0.858 JDT 0.341 0.552 0.570 0.641 0.713 LC 0.350 0.513 0.581 0.589 0.659 ML 0.333 0.504 0.555 0.612 0.766 PDE 0.412 0.436 0.530 0.518 0.612
[0153] 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.
[0154] A supervised multi-view software defect prediction system based on an autoencoder 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:
[0155] Input and output devices;
[0156] processor;
[0157] Memory;
[0158] as well as
[0159] 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.
[0160] 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 supervised multi-view software defect prediction method based on autoencoder, characterized in that: include: Using a single metric to represent data from different software module views; The method of using a single metric to represent data of different software module views comprises the steps of: any software module sample v in the software warehouse i According to the static measurement and dynamic measurement, they are expressed as and Defining static software module viewsets The single metric representation of is: in represents a collection of metrics shared by static software module views, Represents a view-specific set of metrics, 0 (S) Zero matrix representing static software module views; defines a set of dynamic software module views The single metric representation of is: in A collection of metrics that represent the shared view of a dynamic software module. Represents a set of metrics specific to a dynamic software module view. (D) A zero matrix representing a dynamic software module view; Normalize single metric datasets from different software module views; Constructing a first network model according to the multi-view software module sample data, wherein the first network model is constructed by minimizing the reconstruction loss term to obtain a specific autoencoder network for different software module views; Constructing a second network model according to the multi-view software module sample data, wherein constructing the second network model is to construct an intra-view discrimination loss function for identifying intra-view discrimination information through an intra-class scatter matrix and an inter-class scatter matrix; Constructing a third network model according to the first network model; constructing the third network model is to construct a correlation loss function between views according to the correlation structure information between the view encoding features of different software modules of the first network model; Constructing a fourth network model according to the first network model, the second network model and the third network model; The multi-view software test data is input into the fourth network model to obtain the prediction result.
2. The supervised multi-view software defect prediction method based on autoencoder according to claim 1, characterized in that: The method of normalizing the single metric data sets of different software module views is to use the min-max normalization method to normalize the single metric data sets of static software module views. Single metric dataset for dynamic software module views The values of each metric in are linearly transformed to the interval [0,1].
3. The supervised multi-view software defect prediction method based on autoencoder according to claim 2, characterized in that: The specific autoencoder network of different software module views is obtained by minimizing the reconstruction loss term, including the steps of: Building Static View Autoencoder StaNet auto , StaNet auto The network parameters are The normalized static software module view single metric dataset Enter StaNet auto Network, Output where f (S) Representing StaNet auto The mapping function of the network, M represents the number of network layers; A specific network encoding function that constructs a static software module view by minimizing the reconstruction error loss term: Building a Dynamic View Autoencoder DiaNet auto , DiaNet auto The network parameters are The normalized dynamic software module view single metric dataset Enter DiaNet auto Network, Output f (D) Representing DiaNet auto The mapping function of the network; A specific network encoding function that constructs a dynamic software module view by minimizing the reconstruction error loss term:
4. The supervised multi-view software defect prediction method based on autoencoder according to claim 3, characterized in that: The method of constructing an intra-view discrimination loss function for identifying intra-view discrimination information by using an intra-class scatter matrix and an inter-class scatter matrix comprises the following steps: The encoding feature set output by the specific network coding function of the static software module view is denoted as F (S) =F (M / 2,S) , M / 2 represents the number of coding layers; the coding feature set output by the specific network coding function of the dynamic software module view is recorded as F (D) =F (M / 2,D) ; Let the network parameters of the static view autoencoder be and the network parameters of the dynamic view autoencoder Consistent, denoted as θ; Compute the intra-class scatter matrix Among them, c = 0 means that the sample category is defect-free, and c = 1 means that the sample category is defective. represents the mean value of the c-th class of static software view samples, represents the mean of the c-th type of dynamic software view samples, n represents the number of samples, n c represents the number of samples in the cth category; Compute the between-class scatter matrix Among them, μ (S) represents the total mean of static software module samples, μ (D) represents the total mean of the dynamic software module samples; Constructing the discriminative loss function within the view Where Tr(.) represents the trace of the matrix.
5. The supervised multi-view software defect prediction method based on autoencoder according to claim 4, characterized in that: The method of constructing a correlation loss function between views according to the correlation structure information between the encoding features of different software module views of the first network model comprises the following steps: Define the correlation between the encoding features of static software module view and dynamic software module view as Rel(F (S) ,F (D) ); Construct the correlation loss function between the static software module view and the dynamic software module view: in I represents the identity matrix, λ1 and λ2 are regularization parameters.
6. The supervised multi-view software defect prediction method based on autoencoder according to claim 5, characterized in that: The fourth network model is constructed according to the first network model, the second network model and the third network model, which is: according to the specific network coding function L(S) of the static software module view auto ), the specific network coding function L(D auto ), the intra-view discrimination loss function L(SD within ) and the correlation loss function L(SD Between ) Construct the final network objective function 7. The supervised multi-view software defect prediction method based on autoencoder according to claim 1, characterized in that: The step of inputting the multi-view software test data into the fourth network model to obtain the prediction result comprises the steps of: Any test software sample data v test According to static measurement and dynamic measurement, it can be divided into and Static view software test data and dynamic view software test data Input the fourth network model to obtain sample feature values; Input sample feature values into the classifier; The classifier outputs the classification result as a value of 0 or 1 according to the sample feature value. The value 0 indicates no defect, and the value 1 indicates a defect, which is the prediction result.
8. A supervised multi-view software defect prediction system based on autoencoder, characterized by 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 7.
Citation Information
Patent Citations
Software defect prediction method based on deep own coding network
CN108459955A
Cross-project software defect prediction method based on supervised expression learning
CN110751186A