Software defect prediction method based on clustering ensemble learning

Through the clustering ensemble learning method, combining chi-square test and sparse principal component analysis for feature selection, and using multiple clustering algorithms for integration processing, the limitations of feature selection and single clustering methods in the existing technology are solved, and the efficiency is improved The accuracy and reliability of software defect prediction enable more efficient software defect identification.

CN118626384APending Publication Date: 2024-09-10ZHENGZHOU UNIVERSITY OF LIGHT INDUSTRY
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202410817614.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-24
Publication Date
2024-09-10

AI Technical Summary

Technical Problem

Existing software defect prediction methods require performance evaluation of various feature selection methods, and experiments and comparative analysis in different data sets and application scenarios, which consumes a lot of time and cost; a single clustering method is ineffective in the face of complex and diverse problems. When software defect data is collected, data characteristics and patterns cannot be fully captured, resulting in some defects not being correctly identified or predicted, reducing the accuracy and reliability of prediction.

Method used

A software defect prediction method based on clustering ensemble learning is used, combined with chi-square test and sparse principal component analysis for feature selection, and a clustering ensemble method composed of four methods: spectral clustering, Newman clustering, fluid clustering and CNM clustering. For software defect prediction, significant features are screened out through chi-square sparse feature selection, dimensionality is reduced through sparse principal component analysis, and a weighted adjacency matrix is ​​constructed for clustering and integration processing. Finally, defect prediction and labeling are performed based on the integration results.

Benefits of technology

Significantly improves the accuracy and reliability of software defect prediction. Compared with the basic clustering method, the performance is significantly improved. It demonstrates the potential advantages of the cluster integration method in unsupervised learning and reduces the complexity of feature selection and cluster analysis. sex and cost.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118626384A
    Figure CN118626384A
Patent Text Reader

Abstract

The invention discloses a software defect prediction method based on clustering ensemble learning, and relates to the technical field of software defect prediction. Compared with a previous software defect prediction method, the method solves the problems that an existing software defect prediction method needs a large amount of data for comparison, and a large amount of time and operation cost are consumed; the problems that data are analyzed and processed from a specific angle only through a single clustering method, and the characteristics and modes of the data cannot be comprehensively captured are solved; performing feature selection by combining feature selection strategies of chi-square test and sparse principal component analysis; the method comprises the following steps: firstly, screening out features with the most statistical significance by using chi-square test, and then carrying out dimensionality reduction on the significant features by using sparse principal component analysis; and software defect prediction is carried out based on a clustering integration method composed of four methods of spectral clustering, Newman clustering, fluid clustering and CNM clustering. The performance is obviously improved; beneficial guidance is provided for future work, and potential advantages of a clustering integration method in unsupervised learning are emphasized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of software defect prediction, and in particular to a software defect prediction method based on clustering ensemble learning. Background Art

[0002] With the rapid development of information technology, people's daily lives are inseparable from various application software. However, due to the diversification of software functions, the complexity of program development has increased, resulting in more and more defects in the software. In software engineering, software defect prediction is the process of identifying defective files and modules that require rigorous testing. The prediction process includes data collection, data preprocessing, feature engineering, model selection and training, performance evaluation, and model updating. Software defect prediction is one of the important activities in the software development life cycle. It is completed by classifying software instances as defective or non-defective, and plays a vital role in improving the quality of software products. By predicting defects, the development team can focus on potential problems, reduce later repair and maintenance work, reduce development costs, realize resource allocation and priority management, and ensure that key issues are resolved in a timely manner.

[0003] Software defect prediction based on supervised learning has good interpretability and prediction accuracy, can clearly identify defect types, and is helpful for defect management and prevention. However, this method requires a large amount of labeled data. In practice, it is usually difficult to collect defect classification labels to train supervised defect prediction models. Obtaining a large amount of high-quality labeled data requires a lot of time and manpower costs, and it cannot handle unknown defect types. It is sensitive to data distribution and labels may introduce errors.

[0004] Unsupervised machine learning is increasingly used in software defect prediction. Software defect prediction based on unsupervised learning overcomes the limitation that traditional supervised learning requires a large amount of labeled data, can automatically discover unknown problems, and is suitable for situations where labeled data is lacking or multi-category problems need to be processed. Software defect prediction based on unsupervised learning reduces the annotation cost, improves the scalability and adaptability of the model, and is more easily adapted to the evolving software environment. It can cope with new defect types, adapt to different data distributions, provide opportunities for multi-source data integration, and further improve software quality and reliability. The present invention mainly uses clustering ensemble learning methods to predict software defects. The following problems still need to be solved in current research:

[0005] 1. In the study of defect prediction methods based on clustering ensemble learning, different feature selection methods are used to process the data set to determine which method is more effective in a specific situation. This not only involves the performance evaluation of various feature selection methods, but also requires experiments and comparative analysis in different data sets and application scenarios to find the optimal feature selection strategy in a specific situation and improve the accuracy and reliability of defect prediction.

[0006] 2. In the research of clustering-based defect prediction methods, a single clustering method can usually only analyze and process data from a specific perspective. When faced with complex and diverse software defect data, it may not be able to fully capture the characteristics and patterns of the data. This limitation may lead to some defects not being correctly identified or predicted, thereby reducing the accuracy and reliability of the prediction.

[0007] In order to solve the above problems, the present invention proposes a software defect prediction method based on clustering ensemble learning. Summary of the invention

[0008] The purpose of the present invention is to propose a software defect prediction method based on clustering ensemble learning to solve the problems raised in the background technology:

[0009] Existing software defect prediction methods require performance evaluation of various feature selection methods, as well as experiments and comparative analysis in different data sets and application scenarios, which consumes a lot of time and operating costs. Only a single clustering method is used to analyze and process data from a specific perspective, which may not be able to fully capture the characteristics and patterns of the data when faced with complex and diverse software defect data. This limitation may result in some defects not being correctly identified or predicted, thereby reducing the accuracy and reliability of the prediction.

[0010] In order to achieve the above object, the present invention adopts the following technical solutions:

[0011] The software defect prediction method based on clustering ensemble learning includes the following steps:

[0012] S1: Set labels indicating whether the software entity has defects, convert the labels into corresponding received values, and then convert the data set into an attribute relationship file format;

[0013] S2: feature processing of stored items based on the chi-square sparse feature selection method;

[0014] S3: Normalize the reduced-dimensional data, construct a weighted adjacency matrix, perform clustering and integration based on a clustering algorithm, and perform defect prediction and labeling based on the integration results.

[0015] Preferably, in S2, the chi-square test is used to evaluate the correlation between the features and the target variable, the features are screened based on significance, and then the dimensionality of the screened features is reduced by sparse principal component analysis.

[0016] Preferably, the steps of the chi-square test are as follows:

[0017] S2.1.1: Propose hypothesis H0: The data is consistent with the expected distribution;

[0018] S2.1.2: Calculate the chi-square value χ according to the following formula 2 :

[0019]

[0020] Among them, observed represents the observed value of each data; expected represents the predicted value of each data;

[0021] S2.1.3: Calculate degrees of freedom based on the contingency table;

[0022] S2.1.4: Query the contingency table to detect whether the chi-square value satisfies the corresponding confidence value. If so, accept the hypothesis; otherwise, reject the hypothesis.

[0023] Preferably, the sparse principal component analysis is specifically as follows:

[0024] S2.2.1: Standardize the raw data;

[0025] S2.2.2: Select the number of principal components;

[0026] S2.2.3: Initialize the principal component loading matrix;

[0027] S2.2.4: Update the principal component loading matrix by an iterative method;

[0028] S2.2.5: Reconstruct the original data using the updated loading matrix to obtain sparse principal components; wherein the goal of the sparse principal component analysis is to minimize the objective function J(X, Y), and the objective function J(X, Y) is specifically as follows:

[0029]

[0030] Among them, X is the original data matrix; Y is the loading matrix of the principal components; is the Frobenius norm, which represents the bisection root of the sum of squares of the matrix; ||Y|| L is the L1 norm, which represents the sum of the absolute values ​​of the matrix elements; α is the control parameter of sparsity.

[0031] Preferably, S3 is specifically as follows:

[0032] S3.1: Normalize software metrics based on the Z-score standardization method;

[0033] S3.2: Construct a weighted adjacency matrix based on the dot product matrix or Pearson correlation coefficient to provide the relationship information between nodes for the clustering algorithm;

[0034] S3.3: Perform clustering based on spectral clustering, Newman clustering, fluid clustering and CNM clustering algorithms, and perform integrated learning on the clustering results to obtain the cluster identification of each node under different methods, and take the intersection of the integrated results;

[0035] S3.4: Based on the ensemble learning result, the software entity is divided into two clusters, and then the average normalized metric value of each cluster is calculated, and the cluster with a larger average normalized metric value is marked as defective, and the cluster with a smaller average normalized metric value is marked as non-defective.

[0036] Preferably, the dot product matrix in S3.2 is used to perform a dot product operation on each pair of row vectors or column vectors in the matrix and arrange the results in a matrix:

[0037] For two matrices A and B, if A is an m×n matrix and B is an n×p matrix, the dot product C is an m×p matrix, where each element c of C ij The calculation is as follows:

[0038]

[0039] Among them, a ik represents the element in the i-th row and k-th column of matrix A; b kj represents the element in the kth row and ith column of matrix B; n represents the intermediate dimension of the multiplication of two matrices;

[0040] The Pearson correlation coefficient is used to measure the linear correlation between two continuous variables, as follows:

[0041]

[0042] Among them, r is two variables x l and l The correlation coefficient of ; L is the sample size; x l and l are the lth observation values ​​of the two variables respectively; and are the average values ​​of the two variables.

[0043] Compared with the prior art, the present invention provides a software defect prediction method based on clustering ensemble learning, which has the following beneficial effects:

[0044] The present invention combines the feature selection strategies of chi-square test and sparse principal component analysis to perform feature selection. First, the chi-square test is used to screen out the most statistically significant features, and then sparse principal component analysis is used to reduce the dimension of these significant features. A clustering ensemble method consisting of four methods, spectral clustering, Newman clustering, fluid clustering and CNM clustering, is also used to predict software defects. Significant improvements have been achieved in performance. Compared with its basic clustering method, the clustering ensemble method is more superior as an unsupervised SDP classifier. This provides useful guidance for future work and emphasizes the potential advantages of clustering ensemble methods in unsupervised learning. BRIEF DESCRIPTION OF THE DRAWINGS

[0045] Figure 1 This is a flow chart of the method mentioned in Example 1 of the present invention;

[0046] Figure 2 This is the process framework diagram mentioned in Example 1 of the present invention. DETAILED DESCRIPTION

[0047] The technical solutions in the embodiments of the present invention will be described clearly and completely below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all the embodiments.

[0048] The present invention combines the feature selection strategies of chi-square test and sparse principal component analysis to perform feature selection. First, the chi-square test is used to screen out the most statistically significant features, and then sparse principal component analysis is used to reduce the dimension of these significant features. A clustering ensemble method composed of four methods, spectral clustering, Newman clustering, fluid clustering and CNM clustering, is also used to predict software defects. Significant improvements have been achieved in performance. Compared with its basic clustering method, the clustering ensemble method is more superior as an unsupervised SDP classifier. This provides useful guidance for future work and emphasizes the potential advantages of clustering ensemble methods in unsupervised learning. Specifically including the following contents.

[0049] Embodiment 1:

[0050] See also Figure 1-2 The software defect prediction method based on clustering ensemble learning of the present invention comprises:

[0051] S1: Set labels indicating whether the software entity has defects, convert the labels into corresponding received values, and then convert the data set into the attribute relationship file format; the details are as follows:

[0052] When dealing with software defect prediction problems, it is very important to ensure the consistency of the data format. Specifically, in order to make the framework easy to handle, the defective label is always at the end of all indicators. The purpose is to make the structure of the dataset clearer, help ensure consistency when processing and analyzing data, improve the consistency and readability of data processing, and avoid confusion caused by different label positions between different datasets. For example, in the NASA dataset, its value is "Y" or "N". Among them, "Y" represents defective (positive class) and "N" represents no defect (negative class). In software defect prediction, this binary label is often used to indicate whether the software entity has a defect. In order to make all datasets have a consistent form, the defect label in each dataset will be converted to receive the value "Y" or "N".

[0053] Finally, the dataset is converted to the Attribute Relational File Format (ARFF). ARFF is a text file format that is often closely associated with the Weka software and is used to represent the attributes, instances, and category information of a dataset. It provides a structured way to describe a dataset, including the name and type of the attribute and the specific value of the instance. In tasks such as software defect prediction, converting the dataset to ARFF format can make it easier to share and use between different tools and platforms.

[0054] S2: Perform feature processing based on the chi-square sparse feature selection method from the stored items; the details are as follows:

[0055] Some metrics need to be removed because they have the same value in all entities. These metrics are removed to improve the performance of the model and avoid introducing unnecessary noise in the feature analysis phase.

[0056] Specifically, this embodiment proposes a chi-square sparse feature selection method in this step. All Features are used as a baseline, and the chi-square sparse feature selection method is used to observe whether better performance can be obtained without using defect labels.

[0057] All Feature: A dataset may contain multiple features, each of which describes an aspect of the data. All Feature considers all available features in the dataset instead of selectively using a subset of features in a specific task.

[0058] Chi-square sparse feature selection method: A feature selection strategy that combines the chi-square test and sparse principal component analysis. In this method, the chi-square test is first used to evaluate the correlation between the features and the target variable, and the most statistically significant features are screened out. Then, these significant features are reduced in dimension through sparse principal component analysis, and the key features of the original data are kept as much as possible, and the number of features is reduced, so as to reduce the dimension of the data and retain the key information.

[0059] Specifically, chi-square feature selection is based on the statistical principle of the chi-square test, which can effectively identify the correlation between features and target variables, and screen out features that have a significant impact on the prediction of the target variable through the chi-square test. It helps to improve the performance of the model, thereby reducing the risk of overfitting, simplifying the feature space, and improving the interpretability of the model. The steps and related formulas of the chi-square test are as follows:

[0060] (1) Hypothesis H0: The data is consistent with the expected distribution;

[0061] (2) Calculate the chi-square value χ according to the following formula 2 :

[0062]

[0063] Among them, observed represents the observed value of each data; expected represents the predicted value of each data;

[0064] (3) Calculate the degrees of freedom based on the contingency table;

[0065] (4) Check the table to see if the chi-square value satisfies the given confidence level. If so, accept the hypothesis; otherwise, reject it.

[0066] Based on the chi-square feature selection, sparse principal component analysis is used to further reduce the dimension. The sparsity constraint is introduced to make the principal components sparse while retaining the main structure of the data set. The main load vector with a small number of non-zero items is calculated to achieve feature selection and make the model more interpretable. The steps and related formulas of sparse principal component analysis are as follows:

[0067] 1. Standardized data: Standardize the original data to ensure that the mean of each feature is zero and the variance is one;

[0068] 2. Select the number of principal components: Determine the number of principal components to be retained;

[0069] 3. Initialize the loading matrix: Initialize the loading matrix of the principal component, which is a matrix containing the principal component coefficients;

[0070] 4. Iterative solution: Update the load matrix of the principal component through an iterative method to satisfy the constraints, such as L1 regularization (Lasso regularization);

[0071] 5. Reconstruct data: Use the updated loading matrix to reconstruct the original data and obtain sparse principal components. The goal of sparse principal component analysis is to minimize the following objective function:

[0072]

[0073] Among them, X is the original data matrix; Y is the loading matrix of the principal components; is the Frobenius norm, which represents the bisection root of the sum of squares of the matrix; ||Y|| L is the L1 norm, which represents the sum of the absolute values ​​of the matrix elements; α is the control parameter of sparsity.

[0074] By combining the chi-square test and sparse principal component analysis, the chi-square sparse feature selection method can reduce redundant features while retaining key information, improve the generalization ability and performance of the model, and has advantages in processing high-dimensional data, improving model efficiency and interpretability. Especially when the data has a large number of features but only a few have a significant impact on the target variable, this has a positive impact on processing high-dimensional data, reducing the computational burden, and building a more concise and effective model.

[0075] S3: Normalize the data after dimensionality reduction, construct a weighted adjacency matrix, perform clustering and integration based on the clustering algorithm, and perform defect prediction and labeling based on the integration results. The specific four processing steps are as follows:

[0076] The first step is normalization. Specifically, since software metrics have different scales, normalization is required. The Z-score normalization method is applied to all software metrics to ensure that after this step, the variance of all software metrics becomes 1 and the mean becomes 0. This process makes metrics of different scales comparable and provides a consistent benchmark for subsequent analysis.

[0077] The second step is to construct a weighted adjacency matrix W. Specifically, the present invention uses two methods to complete the construction of the matrix W: the dot product matrix and the Pearson correlation coefficient (PCC Matrix). The role of these two matrices is to provide the clustering algorithm with the relationship information between the nodes. The clustering algorithm can identify nodes with similarity or correlation based on these matrices, aggregate similar nodes together, and divide them into the same cluster.

[0078] Specifically, the dot product matrix (Dot Product Matrix): also known as the inner product matrix (Inner Product Matrix) or Gram Matrix (Gram Matrix). Perform dot product operations on each pair of row vectors (or column vectors) in the matrix and arrange the results in a matrix. The calculation formula is:

[0079] For two matrices A and B, if A is an m×n matrix and B is an n×p matrix, the dot product C is an m×p matrix, where each element c of C ij The calculation is as follows:

[0080]

[0081] Among them, a ik represents the element in the i-th row and k-th column of matrix A; b kj represents the element in the kth row and ith column of matrix B; n represents the intermediate dimension of the multiplication of two matrices;

[0082] Specifically, the Pearson correlation coefficient (PCC Matrix): is used to measure the linear correlation between two continuous variables. Its calculation formula is as follows:

[0083]

[0084] Among them, r is two variables x l and l The correlation coefficient of ; L is the sample size; x l and l are the lth observation values ​​of the two variables respectively; and are the average values ​​of the two variables.

[0085] This formula states that the correlation coefficient is the ratio of the sum of the products of the deviations of the two variables from their respective means, divided by the square root of the product of the sum of the squares of the deviations of the two variables from their means. The correlation coefficient can range from -1 to 1. A correlation coefficient close to 1 indicates a strong positive correlation between the two variables, that is, they increase as each other increases. A correlation coefficient close to -1 indicates a strong negative correlation between the two variables, that is, they decrease as each other increases. A correlation coefficient close to 0 indicates that there is no linear relationship between the two variables.

[0086] The third step is clustering. The present invention integrates the results of spectral clustering, Newman clustering, fluid clustering and CNM clustering. For each node, the above four methods are used for clustering to obtain the cluster identification of each node under different methods, and finally the intersection of the results obtained by several clustering methods is taken. If all nodes are divided into the same cluster, the node finally belongs to this cluster. If the division results are inconsistent, the final intersection is empty. In this way, the final clustering division result is recognized by the four methods. The purpose of this approach is to reduce the possible misjudgment of a single method, make a comprehensive judgment through various information, and improve the robustness and accuracy of clustering division. Taking the intersection of clustering division results is a simple and intuitive method in integrated learning, which is usually called voting.

[0087] Step 4: Labeling. Specifically, the two clusters output by clustering are labeled as defective and non-defective, respectively. Using the method that software entities containing defects have larger values ​​in most metrics, and software entities without defects are smaller or simpler, the unsupervised algorithm divides the software entities into two clusters and calculates the average normalized metric value of each cluster. The cluster with a larger value is predicted to be defective, while the cluster with a smaller value is considered to be non-defective. This method is used to label the clustering results and clearly distinguish between the two categories of defective and non-defective, thus providing a basis for subsequent analysis and decision-making.

[0088] Comparative Example:

[0089] This comparative example uses comparative experiments to verify that the proposed method has better performance in software defect prediction. Specifically, the traditional feature selection method and the commonly used clustering method are used for experiments, and then the experimental results of the above models are compared. Here, different feature selection methods (KPCA, NMF) and the chi-square sparse feature selection method proposed in the present invention are mainly selected for comparison.

[0090] The present invention uses two datasets, PROMISE and NASA, which are publicly available and have been widely used in defect prediction research.

[0091] PROMISE is a series of public datasets in the field of software engineering, which aims to support and promote research in the field of software engineering. The dataset contains multiple subsets, covering different software engineering tasks, such as defect prediction, code clone detection, and software process improvement. The wide application of the PROMISE dataset provides researchers with a repeatable and verifiable experimental platform, promoting in-depth research on software engineering issues in academia. Table 1 shows more information about the PROMISE dataset.

[0092] Table 1: Defect information of open source projects in PROMISE repository

[0093] Project name and version number Number of defects Number of modules Defect Rate ant-1.7 166 745 22.28 ivy-1.4 16 241 6.64 jedit-4.0 75 306 24.51 log4j-1.0 34 135 25.19 Tomcat v6.0 77 858 8.97 xalan-2.6 411 885 46.44 xerces-1.3 69 453 15.23 lucene-2.4 203 340 59.71 camel-1.6 188 965 19.48 poi-3.0 281 442 63.57

[0094] NASA covers multiple fields, including aerospace, earth science, and space probes. These datasets are collected by NASA in its various missions to support scientific research, engineering design, and decision-making. The wide application of NASA datasets provides valuable experimental materials for solving complex real-world problems. Its high quality and diversity make it an important resource for the scientific and engineering fields, providing support for promoting technological and scientific progress. Table 2 shows more information about NASA datasets.

[0095] Table 2: Vulnerability information for open source projects in NASA's repository

[0096]

[0097]

[0098] The present invention uses AUC to evaluate the effectiveness of the software defect prediction method. AUC (area under the ROC curve) is a widely used indicator for measuring classification performance. The ROC curve is a curve with the True Positive Rate (also known as sensitivity) as the vertical axis and the False Positive Rate (also known as the complement of specificity) as the horizontal axis.

[0099] AUC = 1: The model performs very well and perfectly distinguishes positive and negative examples.

[0100] AUC = 0.5: The performance of the model is comparable to random guessing, and the curve is close to the diagonal line.

[0101] AUC < 0.5: Model performance is worse than random guessing, that is, the model performance is poor.

[0102] Table 3 and Table 4 are the experimental results of the present invention, wherein:

[0103] The bold font indicates the markers with the best performance using the same method of constructing the adjacency matrix and feature selection method, but different clustering methods.

[0104] The underlined fonts indicate the best performing markers using the same method for constructing the adjacency matrix and clustering method, but different feature selection methods.

[0105] AUC < 0.5 indicates a poorly performing marker.

[0106] Table 3: Performance of some projects in the PROMISE dataset

[0107]

[0108]

[0109] From the perspective of constructing the adjacency matrix, using the Dot Product Matrix has better performance than the PCCMatrix in most cases. Using the dot product matrix may be more suitable for capturing the relationship between the data, thereby improving the overall performance.

[0110] From the perspective of clustering methods, using the same adjacency matrix construction method and feature selection method, the AVERAGE AUC of the clustering ensemble method proposed in this invention is better than that of the four basic clustering methods, and the performance is significantly improved. This shows that the clustering ensemble method has better generalization ability and robustness for software defect prediction, and can more effectively capture the inherent patterns and structures of the data than a single clustering method.

[0111] Regarding feature selection methods, using the same adjacency matrix construction method and clustering method, the chi-square sparse feature selection method performs best in most cases. The AUC value is significantly improved relative to All Features. Optimizing feature selection methods remains a challenge and requires further adjustment and improvement. These findings provide a useful method and empirical basis for the field of software defect prediction.

[0112] Table 4: Performance of some projects in NASA dataset

[0113]

[0114] From the perspective of the method of constructing the adjacency matrix, in most cases, using Dot Product Matrix has better performance than PCC Matrix. However, the results of PCC Matrix are more stable and may be more reliable in certain scenarios.

[0115] From the perspective of clustering methods, when the same method is used to construct the adjacency matrix and perform feature selection, the proposed clustering ensemble method performs well in most cases, either outperforming or comparable to other clustering methods. Only in very few cases does the performance of the clustering ensemble method slightly underperform that of the four other clustering methods.

[0116] In terms of feature selection, using the same adjacency matrix construction method and clustering method, the chi-square sparse feature selection method performs best in most cases. However, for some specific data distributions or problems, it is necessary to further optimize the chi-square sparse feature selection method or consider other feature selection strategies. These findings provide important inspiration for selecting appropriate adjacency matrix construction, clustering methods, and feature selection methods in software defect prediction in the future.

[0117] The above description is only a preferred specific implementation manner of the present invention, but the protection scope of the present invention is not limited thereto. Any technician familiar with the technical field can make equivalent replacements or changes according to the technical scheme and inventive concept of the present invention within the technical scope disclosed by the present invention, which should be covered by the protection scope of the present invention.

Claims

1. A software defect prediction method based on clustering ensemble learning, characterized in that: The steps include: S1: Set labels indicating whether the software entity has defects, convert the labels into corresponding received values, and then convert the data set into an attribute relationship file format; S2: feature processing of stored items based on the chi-square sparse feature selection method; S3: Normalize the reduced-dimensional data, construct a weighted adjacency matrix, perform clustering and integration based on a clustering algorithm, and perform defect prediction and labeling based on the integration results.

2. The software defect prediction method based on clustering ensemble learning according to claim 1, characterized in that: In S2, the chi-square test is used to evaluate the correlation between the features and the target variable, the features are screened based on significance, and then the dimensionality of the screened features is reduced by sparse principal component analysis.

3. The software defect prediction method based on clustering ensemble learning according to claim 2 is characterized in that: The steps of the chi-square test are as follows: S2.1.1: Propose hypothesis H0: The data is consistent with the expected distribution; S2.1.2: Calculate the chi-square value χ according to the following formula 2 : Among them, observed represents the observed value of each data; expected represents the predicted value of each data; S2.1.3: Calculate degrees of freedom based on the contingency table; S2.1.4: Query the contingency table to detect whether the chi-square value satisfies the corresponding confidence value. If so, accept the hypothesis; otherwise, reject the hypothesis.

4. The software defect prediction method based on clustering ensemble learning according to claim 2, characterized in that: The sparse principal component analysis is specifically as follows: S2.2.1: Standardize the raw data; S2.2.2: Select the number of principal components; S2.2.3: Initialize the principal component loading matrix; S2.2.4: Update the principal component loading matrix by an iterative method; S2.2.5: Reconstruct the original data using the updated loading matrix to obtain sparse principal components; wherein the goal of the sparse principal component analysis is to minimize the objective function J(X, Y), and the objective function J(X, Y) is specifically as follows: Among them, X is the original data matrix; Y is the loading matrix of the principal components; is the Frobenius norm, which represents the bisection root of the sum of squares of the matrix; ||Y|| L is the L1 norm, which represents the sum of the absolute values ​​of the matrix elements; α is the control parameter of sparsity.

5. The software defect prediction method based on clustering ensemble learning according to claim 1, characterized in that: The S3 is as follows: S3.1: Normalize software metrics based on the Z-score standardization method; S3.2: Construct a weighted adjacency matrix based on the dot product matrix or Pearson correlation coefficient to provide the relationship information between nodes for the clustering algorithm; S3.3: Perform clustering based on spectral clustering, Newman clustering, fluid clustering and CNM clustering algorithms, and perform integrated learning on the clustering results to obtain the cluster identification of each node under different methods, and take the intersection of the integrated results; S3.4: Based on the ensemble learning result, the software entity is divided into two clusters, and then the average normalized metric value of each cluster is calculated, and the cluster with a larger average normalized metric value is marked as defective, and the cluster with a smaller average normalized metric value is marked as non-defective.

6. The software defect prediction method based on clustering ensemble learning according to claim 5 is characterized in that: The dot product matrix described in S3.2 is used to perform dot product operations on each pair of row vectors or column vectors in the matrix and arrange the results in a matrix: For two matrices A and B, if A is an m×n matrix and B is an n×p matrix, the dot product C is an m×p matrix, where each element c of C ij The calculation is as follows: Among them, a ik represents the element in the i-th row and k-th column of matrix A; b kj represents the element in the kth row and ith column of matrix B; n represents the intermediate dimension of the multiplication of two matrices; The Pearson correlation coefficient is used to measure the linear correlation between two continuous variables, as follows: Among them, r is two variables x l and l The correlation coefficient of ; L is the sample size; x l and l are the lth observation values ​​of the two variables respectively; and are the average values ​​of the two variables.

Citation Information

Cited By

  • Method for automatically evaluating accuracy of defect identification software

    CN120492204A

  • An automatic evaluation method for the accuracy of defect identification software

    CN120492204B