Next Article in Journal
Assessment of Healing after Diode Laser Gingivectomy Prior to Prosthetic Procedures
Previous Article in Journal
Anomaly Detection for Automated Vehicles Integrating Continuous Wavelet Transform and Convolutional Neural Network
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

Multi-Source Heterogeneous Kernel Mapping in Software Defect Prediction

School of Reliability and Systems Engineering, Beihang University, Beijing 100191, China
*
Author to whom correspondence should be addressed.
Appl. Sci. 2023, 13(9), 5526; https://doi.org/10.3390/app13095526
Submission received: 24 March 2023 / Revised: 21 April 2023 / Accepted: 26 April 2023 / Published: 28 April 2023

Abstract

:
Heterogeneous defect prediction (HDP) is a significant research topic in cross-project defect prediction (CPDP), due to the inconsistency of metrics used between source and target projects. While most HDP methods aim to improve the performance of models trained on data from one source project, few studies have investigated how the number of source projects affects predictive performance. In this paper, we propose a new multi-source heterogeneous kernel mapping (MSHKM) algorithm to analyze the effects of different numbers of source projects on prediction results. First, we introduce two strategies based on MSHKM for multi-source HDP. To determine the impact of the number of source projects on the predictive performance of the model, we regularly vary the number of source projects in each strategy. Then, we compare the proposed MSHKM with state-of-the-art HDP methods and within-project defect prediction (WPDP) methods, in terms of three common performance measures, using 28 data sets from five widely used projects. Our results demonstrate that, (1) in the multi-source HDP scenario, strategy 2 outperforms strategy 1; (2) for MSHKM, a lower number of source projects leads to better results and performance under strategy 1, while n = 4 is the optimal number under strategy 2; (3) MSHKM performs better than related state-of-the-art HDP methods; and (4) MSHKM outperforms WPDP. In summary, our proposed MSHKM algorithm provides a promising solution for heterogeneous cross-project defect prediction, and our findings suggest that the number of source projects should be carefully selected to achieve optimal predictive performance.

1. Introduction

Software defect prediction is a technology that uses historical software defect information to predict the defect state of entities within the software being tested (e.g., classes, files, methods, packages, and so on) [1]. According to the prediction results, software testers can focus on the parts which are more likely to have defects; more importantly, the prediction results provide guidance for the implementation strategy of test cases, in order to realize the reasonable allocation of test resources and improve testing efficiency. Software defect prediction establishes a correlation between historical metrics (also known as features or attributes) and defect information, using machine learning or statistical methods. This correlational relationship is called a software defect prediction model. When an adequate amount of historical version data of the software under test is available, the process of building the software defect prediction model is called within-project defect prediction (WPDP) [2,3,4]. WPDP refers to using a portion of the data set of a given project as the training set to construct a defect prediction model, which is then employed to predict the defect situation of the remaining part. However, it is more often the case that the software being tested has insufficient historical defect data, or is part of a new project without historical data. At this time, metric information and defect data collected from other software (source projects) should be employed to establish a software defect prediction model for the software under test (target project). This process is called cross-project defect prediction (CPDP) [5,6,7]. Furthermore, when the name, order, and number of metric elements across projects are consistent with the metric elements of the tested software, the constructed CPDP model is called a homogeneous defect prediction model, also known as a cross-project defect prediction with common metrics (CPDP-CM) model [8]. However, in practice, there are often large differences in the feature spaces of metrics and the distribution of data between source and target projects, due to differences in application domains, programming languages, development processes, and coder experience, which poses a challenge for CPDP. Generally speaking, the metrics of the source project and those of the target project frequently exhibit disparities; that is, the type or number of metrics is different; this situation is named heterogeneous. For this situation, traditional CPDP methods are not applicable and have limitations. To solve the inconsistency of metrics between source and target projects, researchers have proposed heterogeneous defect prediction (HDP) approaches [9,10,11,12,13,14,15,16,17,18,19,20,21,22,23].
Although there have been some studies on HDP, most of the data comes from just one source project, and the limitation of a single source project is that it is too dependent on its data quality. If the data from a source project is poorly correlated to the target one, the performance of the classifier may decrease, or even lead to a negative transfer. For a scenario with multi-source projects, negative transfers can be reduced by increasing the number of source projects. However, there are not many studies on multi-source HDP, and the models associated with it need improving. Moreover, few studies have focused on how the number of source projects impacts model performance. In practice, the experience of selecting the proper number of source projects can directly guide engineers to build high-performance models, under the premise of saving time and improving efficiency.
In this paper, we propose the multi-source heterogeneous kernel mapping (MSHKM) approach, based on heterogeneous mapping (HeMap) [24] and KSETE [17], to predict the defect proneness of each module from the target project by learning the knowledge in the data sets of multiple source projects, which are heterogeneous with the feature space of the target project. The core idea of the MSHKM is to map the sample data with the different metrics of multiple-source projects into the same feature space at the same time, under the premise of minimal information loss. At the same time, we apply the MSHKM algorithm to two multi-source mapping strategies, and conduct experimental comparison. Furthermore, we explore the impact of the quantity of source projects on the MSHKM algorithm by changing the quantity parameters for the two strategies.
In summary, the main contributions of this study are as follows:
(1)
Considering problems, including multiple inconsistent feature spaces, distribution differences, non-linear correlations, and data imbalances, a novel multi-source HDP method, named MSHKM (with two strategies), is addressed.
(2)
To evaluate the performance of the MSHKM algorithm under different strategies, experiments are performed on 28 public data sets from five projects—NASA [25], SOFTLAB [26], Relink [27], AEEEM [28], and MORPH [29]—under HDP and WPDP scenarios. The experimental results indicate that our proposed MSHKM outperforms the baseline approaches.
(3)
Furthermore, we provide a replication package of MSHKM, including the source code and data sets, which is available on the website: https://doi.org/10.5281/zenodo.7692416 (accessed on 9 March 2023).
The remainder of the paper is structured as follows: The next section will introduce the previous work on HDP and multi-source transfer learning. In Section 3, we propose the research methodology, including definitions, hypotheses, methods, formula derivations, and algorithms. Section 4 describes the conducted experiments, including research questions, benchmark data sets, evaluation measures, and the setup we used in our experiments. Section 5 provides an analysis of the experimental results, and Section 6 details the statistical tests. In Section 7, we discuss the limitations of our study and suggest potential directions for future work. Finally, we conclude the work of this paper in Section 8.

2. Related Works

2.1. Heterogeneous Defect Prediction

There have been several studies on HDP. Nam et al. [9] introduced a method for HDP, utilizing metric matching as its foundation. First, feature selection is carried out on the source data to eliminate irrelevant or redundant features. Second, a metric match analyzer is used to calculate the matching scores between source and target data. Finally, a conventional machine learning method is used to facilitate the model training process and predict the defect tendency.
Jing et al. [10] introduced the statistical canonical correlation analysis (CCA) method into CPDP, and proposed a new method called CCA+. The core idea is to take the canonical correlation coefficient as the measurement standard of disparity in the distribution between the datasets, minimizing the canonical correlation coefficient to diminish the distribution discrepancy between the source and target data sets. The specific principles are as follows: First, the source and target data are pre-processed to construct a unified metric representation (UMR). Then, on the basis of UMR, canonical correlation analysis is carried out to calculate the projection vector and the mapping outcomes of both source and target data under the projection vector. Finally, the defect tendency within the target data set is forecast using the nearest neighbor classification in the new projection space, based on CCA+.
Cheng et al. [11] introduced an innovative support vector machine algorithm for HDP, called the cost-sensitive correlation transfer support vector machine (CCT-SVM). They stated that the key emphasis of the software defect prediction process is placed on risk costs. By endeavoring to classify a module as defective, CCT-SVM offers an effective solution for reducing the negative impact of data imbalance. The specific method is as follows: First, the UMR technique is employed to enable the comparison of heterogeneous data. Subsequently, drawing upon the UMR result for heterogeneous data, the CCA technique is utilized to identify a common representation for features extracted from both source and target projects. Finally, they construct a novel SVM model for heterogeneous defect prediction by introducing a correlation regularizer and specific misclassification costs.
Ma et al. [12] put forward a new methodology, KCCA+, by combining a kernel function with CCA+, considering that CCA is essentially a linear transformation, and that there are often complex non-linear relationships between metric elements of different data sets.
Li et al. [13] applied the technique of cost-sensitive learning and combined it with kernel learning technology to suggest a novel analysis approach for HDP, called cost-sensitive transfer kernel canonical correlation analysis (CTKCCA), which aims to address the problem of linear inseparability and alleviate issues related to class imbalance in the software defect prediction process.
Yu et al. [14] presented a heterogeneous cross-project defect tendency prediction algorithm on the basis of feature matching, called feature match transfer (FMT). The principle is as follows: First, the features of source data are selected, and the distribution curves of the features are calculated. Simultaneously, the method employed to calculate the distribution curves of features in the target data remains consistent. Then, according to a defined feature distance formula, feature matching between the source data and target data is completed. Finally, the model is trained, and the defects in the target data are predicted on the matched feature space.
Li et al. [15] incorporated the concept of ensemble learning, and proposed a novel HDP method, known as ensemble multi-kernel correlation alignment (EMKCA). EMKCA constructs multiple kernels, based on different types of features extracted from the source and target domains. These kernels are then combined into a single kernel matrix, using an ensemble approach. The kernel matrix is then used to align the source and target domains by maximizing the correlation between them. After that, in [16], they presented a novel two-stage ensemble learning (TSEL) method for HDP. In the first stage, the EMKCA method is employed. In the second stage, the RESample with replacement (RES) technique is adopted to train multiple EMKCA predictors with diversity, which are then aggregated using the average ensemble method.
Tong et al. [17] suggested an innovative approach for HDP, called the kernel spectral embedding transfer ensemble (KSETE). Their approach entails tackling the class imbalance issue within the source data set initially, then combining kernel spectral embedding, transfer learning, and ensemble learning, to identify potential common kernel feature subspaces. Finally, classifiers are built on every common feature space to make predictions for the target.
Xu et al. [18] proposed a new heterogeneous domain adaptation (HDA) method for HDP. HDA is a subfield of domain adaptation. It is utilized to embed cross-project data into a low-dimensional comparable feature space, followed by the measurement of the dissimilarity between the mapped domains based on dictionary learning techniques. Subsequently, in [19], they proposed a novel Multiple-View Spectral Embedding (MVSE) approach for HDP. MVSE combines multiple views of the data into a unified low-dimensional depiction that aptly captures the underlying structure of the data. In terms of HDP, MVSE utilizes a spectral embedding technique to transform the heterogeneous feature set into a coherent space, maximizing the similarity between the two mapped feature sets. The key idea is to perform spectral embedding on each view of the data.
Gong et al. [20] proposed an unsupervised deep domain adaptation method for HDP. Specifically, they first adopt the unified metric representation (UMR) of the source and target project data. Next, a deep autoencoder is employed to acquire feature representations for both source and target projects. Finally, the maximum mean difference (MMD) is introduced, as a measure to characterize the disparity between the projects, and an adversarial loss function is utilized to minimize the distance between these feature representations.
Wang et al. [22] presented a few-shot learning-based balanced distribution adaptation (FSLBDA), which requires little labeled data to fit the distribution of the target domain. Specifically, first, extreme gradient boosting is employed to eliminate redundant metrics of the data sets. Then, balanced distribution adaptation is utilized to alleviate the difference between the source and target domains. Finally, the influence of a small training data set can be reduced by adaptive boosting.
Zong et al. [23] recently introduced optimal transport (OT) theory, and proposed two prediction algorithms for HDP using optimal transport: one algorithm is based on the entropic Gromov–Wasserstein (EGW) discrepancy, while the other is the EGW+ transport algorithm. Specifically, the method first computes a transportation plan that minimizes the discrepancy between the source and target distributions. Subsequently, a weighted transfer learning approach is used to transfer knowledge from the source domain to the target domain, based on the transportation plan.
The above HDP methods all use single-source project data as training data. However, in order to obtain good model performance, the data quality of the source project needs to be high. Once the data does not meet the requirements, it will lead to negative transfers. In this scenario, these methods cannot achieve satisfactory model performance.

2.2. Multi-Source Transfer Learning

For the multi-source heterogeneous problem, there have been some studies in other fields. Wu et al. [30] proposed multiple graphs and low-rank embedding (MGLE) for the learning of representations of data points in a graph which employs a low-rank embedding to acquire a shared representation for the data across multiple graphs. Specifically, the method learns a low-dimensional embedding for each graph separately, then combines these embeddings into a shared representation, using a weighted sum.
Chai et al. [31] put forward a method for predicting future price fluctuations, using a combination of heterogeneous data sources. The method utilizes natural language processing techniques to extract relevant information from multiple heterogeneous textual data sources, then combines this information with numerical data from financial statements. The combined data are then used to train a machine learning model to predict future price fluctuations.
Zhao et al. [32] proposed an ontology and mapping heterogeneous data from multiple sources, using a combination of a hybrid neural network, composed of a convolutional neural network (CNN), a recurrent neural network (RNN), and an autoencoder, which is employed to learn a low-dimensional representation of the data that can be used to construct an ontology and map data from different sources.
The aforementioned method is primarily used to address multi-source heterogeneous problems in other fields, and there are also some studies on the application of this method for multi-source CPDP.
Chen et al. [33] evaluated the effectiveness of different strategies, with respect to defect prediction, including single-source and multi-source approaches, feature selection, and transfer learning. They concluded that HDP methods based on metric transformation usually have better predictive performance, while HDP methods based on metric selection have better interpretability. Liu et al. [34] evaluated the effectiveness of different multi-source cross-project defect prediction (MSCPDP) models for defect prediction across multiple projects.
However, the above studies considered homogeneous CPDP, rather than heterogeneous. For multi-source HDP, there are two related studies in the literature: Li et al. [35] presented a multi-source selection-based manifold discriminant alignment (MSMDA) approach to address the challenges of using multiple sources of data for heterogeneous defect prediction while preserving privacy, while Wu et al. [21] proposed a multi-source heterogeneous cross-project method (MHCPDP), which is implemented using multi-source transfer learning and autoencoder techniques.
Despite the significance of multi-source HDP, there remains a limited number of studies addressing this topic, with associated models requiring further refinement. Furthermore, the impact of varying numbers of source projects on model performance has received little attention in the literature.

3. Research Methodology

This section describes the details of the proposed method, including feature mapping strategies, data pre-processing, and the multi-source heterogeneous kernel mapping (MSHKM) approach.

3.1. Feature Mapping Strategies

To introduce the feature mapping strategies and MSHKM algorithm, we first identify the target project. Then, we select several source projects in the heterogeneous scenario where the data feature spaces of the source projects and target project differ. The details of the projects and datasets are presented in Section 4.1.
There are two mapping strategies that can be used when conducting a feature space transformation to deal with multi-source HDP.
Strategy 1: Mapping once.
(1)
Input n source projects simultaneously;
(2)
Map n source projects and target project into the same feature space at the same time;
(3)
Take the mapped n source projects data together as the training data of the model.
Strategy 2: Mapping n times.
(1)
Input n source projects successively;
(2)
Map one source project and target project into the same feature space each time;
(3)
The source project data after each mapping is used as training data to build one model, and a total of n models are built after n mapping times.
Figure 1 and Figure 2 present the two strategies of the proposed MSHKM for multi-source HDP, respectively. It is mainly divided into three parts: data pre-processing, multi-source heterogeneous kernel mapping (MSHKM), and model training.
First, the data sets of original source and target projects should be pre-processed under both strategies. Due to the limitations of the MSHKM algorithm (see Section 3.3), before mapping, it is necessary to ensure that the number of samples in each data set are consistent, so, an over-sampling or under-sampling method should be adopted. The pink parts in the figures represent generated data, which cannot be used as test data for the model. The following describes the difference between the two strategies. In strategy 1, all of the source project data and target project data are mapped once by the MSHKM algorithm, following which, the projected source project data are trained in the model. Meanwhile, strategy 2 involves mapping the data of each source project and target project, respectively, by the MSHKM algorithm for a total of n times, then, conducting model training, respectively, to build a total of n models. It is important to note that the generated data must be stripped of the mapped test data (i.e., target project data) before testing, regardless of the strategy.

3.2. Data Pre-Processing

Considering the problems associated with class imbalances and possible noise in software defect data, the defect data are pre-processed as follows: (1) redundant instances are eliminated; (2) instances with missing values are removed; (3) if the positive samples in the source data greatly outnumbered the negative ones, the synthetic minority over-sampling technique (SMOTE) [36] is employed to treat the class imbalance data; and (4) considering the magnitudes of different metrics may vary greatly, Z-score normalization is used to standardize the source and target data sets, such that the mean value of each metric is 0 and its variance is 1.
In order to perform subsequent calculations, it is necessary to ensure that the number of instances in the source and target data sets are consistent. To achieve this, we first determine the quantity empirically, according to the tradeoff of sample size between source and target data sets. Then, samples exceeding this number need to be under-sampled, such as random sampling, and SMOTE should be carried out for samples less than this number, so as to ensure that the multiple data sets have the same number of samples. If the sampled data set is the target data set, the generated samples obtained from these samples need to be removed when predicting the labels of the target data.

3.3. Multi-Source Heterogeneous Kernel Mapping

Multi-source heterogeneous kernel mapping (MSHKM) is based on heterogeneous mapping (HeMap) [24], and is similar to KSETE [17]. Different from KSETE, the input of MSHKM is multiple data sets of different dimensions, so, its feasibility needs to be proved from a theoretical perspective. The mapping principle of MSHKM is to multiply the data sets of source and target projects with different metrics into different projected matrices, respectively, in order to obtain data sets with the same metric feature space, as shown in Figure 3. Thus, the key is to determine the projected matrices. It should be noted that the number of instances for the source and target projects needs to be consistent, so under- or over-sampling technology should be used in data pre-processing.
Denote an unlabeled data set from the target project as T = x t i | i = 1 N t , and some labeled data sets from multiple source projects as S i = x S i j | j = 1 N S i , Y S i = y S i j | j = 1 N S i , i = ( 1 , 2 , , n ) , where x t i and x S i j denote the ith and jth instance in T and S i , drawn from the marginal distributions p t ( x t ) and p S i ( x S i ) , respectively. y S i j denotes the label of the jth instance in S i . N t and N S i are the number of instances in T and S i , respectively, and n is the number of source projects. x t i R 1 l t represents the l t metric value for the ith instance in the target project, while x S i j R 1 l S i denotes the l S i metric value for the jth instance in the source project S i . l S i and l t represent the number of metrics for S i and T , respectively. It should be noted that the metric size for the target and source data are different (i.e., R 1 l t R 1 l S i ). Meanwhile, the marginal distribution of target data p t ( x t ) , and of the source data p S i ( x S i ) , also differ ( p t ( x t ) p S i ( x S i ) ). In other words, the metric sets of the source and target data sets are unlike, or heterogeneous. However, we need to train the model reasonably and effectively, by using labeled data sets from multiple source projects, to predict whether the labels of instances from the target project are defective. This requires that the data sets between the source projects and the target project are in the same feature space and subject to the same distribution. Consequently, we aim to identify a shared feature space for the target data set and multiple source data sets. According to the description above, the flowchart of the MSHKM algorithm is shown in Figure 4.
The first step involves mapping the data from multiple source projects and the target project using a kernel function. Next, we check whether the feature space of the mapped data is consistent. If it is consistent, then it is a homogeneous problem, and only the distribution differences between the data of source and target projects need to be calculated. However, if it is inconsistent, the MSHKM algorithm is needed. To perform the algorithm, we must ensure that the feature space of the product of the optimal projection matrix and the mapping matrix is consistent with the feature space of the matrix before mapping, as specified in Formula (5). We then calculate the optimization function to obtain the optimal projection matrices and its corresponding mapping matrices. Finally, we train the model using the source project data from the optimal projection matrices, and use the target project data for model prediction. The theoretical derivation of the above process is as follows:
Definition 1: Supposing the ith source data set is S i and the target data set is T , Φ ( · ) is defined as a mapping function, where Φ ( S i ) R N S i l S i and Φ ( T ) R N t l t represent the mapping results on the source and target data sets, respectively. On this basis, the optimal projection B Φ ( S i ) and B Φ ( T ) can be obtained through the following optimization objective:
min B Φ ( S i ) , B Φ ( T ) L ( B Φ ( S i ) , Φ ( S i ) ) + L ( B Φ ( T ) , Φ ( T ) ) + β D ( B Φ ( S i ) , B Φ ( T ) ) ,
where L ( · , · ) represents the weighted sum of each difference between the data set after Φ ( · ) mapping and its further mapping data set, such as Φ ( T ) and B Φ ( T ) ; L ( B Φ ( S i ) , Φ ( S i ) ) is defined as follows:
L ( B Φ ( S i ) , Φ ( S i ) ) = i = 1 n θ i ( B Φ ( S i ) , Φ ( S i ) ) ;
and D ( · , · ) represents the weighted sum of each difference between the further mappiing target and source data sets. β is a hyper-parameter, controlling the degree of similarity between two data sets, with value ranging from 0 to 1. We further define D ( B Φ ( S i ) , B Φ ( T ) ) as follows:
D ( B Φ ( S i ) , B Φ ( T ) ) = i = 1 n θ i d ( B Φ ( S i ) , B Φ ( T ) ) ,
where d ( · , · ) denotes the average difference between the mapping target data set Φ ( T ) and the further mapping source data set B Φ ( S i ) , as well as that between the mapping source data set Φ ( S i ) and the further mapping target data set B Φ ( T ) . It is defined as follows:
d ( B Φ ( S i ) , B Φ ( T ) ) = 1 2 ( ( B Φ ( S i ) , Φ ( T ) ) + ( B Φ ( T ) , Φ ( S i ) ) )
It should be noted that θ i is the ith weight of l ( · , · ) , which denotes the importance of the ith source data set, with respect to the target data set. The sum of all θ i is equal to 1. Furthermore, l ( · , · ) denotes the difference between the mapping data set and its further mapping data set, defined as follows:
( B Φ ( S i ) , Φ ( S i ) ) = B Φ ( S i ) P Φ ( S i ) Φ ( S i ) F 2 ( B Φ ( T ) , Φ ( T ) ) = B Φ ( T ) P Φ ( T ) Φ ( T ) F 2 ( B Φ ( S i ) , Φ ( T ) ) = B Φ ( S i ) P Φ ( T ) Φ ( T ) F 2 ( B Φ ( T ) , Φ ( S i ) ) = B Φ ( T ) P Φ ( S i ) Φ ( S i ) F 2 ,
where · F 2 represents the Frobenius norm. P Φ ( S i ) R k l S i and P Φ ( T ) R k l t represent the corresponding mapping matrices of the mapping source and target data sets Φ ( S i ) and Φ ( T ) , respectively. Thus, the optimization objective can be expanded as:
min B Φ ( S i ) Τ B Φ ( S i ) = Ι , B Φ ( T ) Τ B Φ ( T ) = Ι G ( B Φ ( S i ) , B Φ ( T ) , P Φ ( S i ) , P Φ ( T ) ) = min B Φ ( S i ) Τ B Φ ( S i ) = Ι , B Φ ( T ) Τ B Φ ( T ) = Ι Φ ( T ) B Φ ( T ) P Φ ( T ) F 2 + i = 1 n θ i Φ ( S i ) B Φ ( S i ) P Φ ( S i ) F 2 + β i = 1 n θ i ( 1 2 Φ ( S i ) B Φ ( T ) P Φ ( S i ) F 2 + 1 2 Φ ( T ) B Φ ( S i ) P Φ ( T ) F 2 ) ,
where B Φ ( S i ) R N S i k and B Φ ( T ) R N t k . β is a hyperparameter controlling the degree of similarity between B Φ ( S i ) and B Φ ( T ) , and θ i controls the importance of the ith source data set.
Lemma 1.
P Φ ( S i ) and P Φ ( T ) can be calculated as follows:
P Φ ( S i ) = 1 2 + β ( 2 B Φ ( S i ) Τ Φ ( S i ) + β B Φ ( T ) Τ Φ ( S i ) ) P Φ ( T ) = 1 2 + β ( 2 B Φ ( T ) Τ Φ ( T ) + β i = 1 n θ i B Φ ( S i ) Τ Φ ( T ) ) .
Proof of Lemma 1.
According to the following formulas:
X F 2 = t r ( X Τ X ) ,
B Φ ( S i ) Τ B Φ ( S i ) = Ι ,
t r ( P Φ ( s i ) Τ B Φ ( S i ) Τ Φ ( S i ) ) = t r ( B Φ ( S i ) Τ Φ ( S i ) P Φ ( s i ) Τ ) ,
Equation (5) can be described in terms of the matrix trace norm:
Φ ( S i ) B Φ ( S i ) P Φ ( S i ) F 2 = t r ( Φ Τ ( S i ) Φ ( S i ) ) 2 t r ( B Φ ( S i ) Τ Φ ( S i ) P Φ ( S i ) Τ ) + t r ( P Φ ( S i ) Τ P Φ ( S i ) ) .
Similarly, Φ ( T ) B Φ ( T ) P Φ ( T ) F 2 , Φ ( S i ) B Φ ( T ) P Φ ( S i ) F 2 , and Φ ( T ) B Φ ( S i ) P Φ ( T ) F 2 can also be denoted. Then, the optimization objective function stated in Equation (6) can be reformulated as:
min B Φ ( S i ) Τ B Φ ( S i ) = Ι , B Φ ( T ) Τ B Φ ( T ) = Ι G ( B Φ ( S i ) , B Φ ( T ) , P Φ ( S i ) , P Φ ( T ) ) = min B Φ ( S i ) Τ B Φ ( S i ) = Ι , B Φ ( T ) Τ B Φ ( T ) = Ι ( 1 + β 2 ) i = 1 n θ i t r ( Φ Τ ( S i ) Φ ( S i ) ) + ( 1 + β 2 ) t r ( Φ Τ ( T ) Φ ( T ) ) + ( 1 + β 2 ) i = 1 n θ i t r ( P Φ ( S i ) Τ P Φ ( S i ) ) + ( 1 + β 2 ) t r ( P Φ ( T ) Τ P Φ ( T ) ) 2 i = 1 n θ i t r ( B Φ ( S i ) Τ Φ ( S i ) P Φ ( S i ) Τ ) 2 t r ( B Φ ( T ) Τ Φ ( T ) P Φ ( T ) Τ ) β i = 1 n θ i t r ( B Φ ( S i ) Τ Φ ( T ) P Φ ( T ) Τ ) β i = 1 n θ i t r ( B Φ ( T ) Τ Φ ( S i ) P Φ ( S i ) Τ ) .
Taking the derivative of G, with regard to P Φ ( T ) and P Φ ( S i ) , we obtain:
G ( P Φ ( S i ) ) = ( 2 + β ) θ i P Φ ( S i ) 2 θ i B Φ ( S i ) Τ Φ ( S i ) β θ i B Φ ( T ) Τ Φ ( S i ) G ( P Φ ( T ) ) = ( 2 + β ) θ i P Φ ( T ) 2 B Φ ( T ) Τ Φ ( T ) β i = 1 n θ i B Φ ( S i ) Τ Φ ( T ) .
Let G ( P Φ ( T ) ) = 0 and G ( P Φ ( S i ) ) = 0 in the optimal solution, according to the Karush–Kuhn–Tucker conditions [37]. Then, we obtain Equation (7). □
Meanwhile, we obtain the subordinative consequence as follows:
B Φ ( T ) Τ Φ ( T ) = ( 1 + β 2 ) P Φ ( T ) β 2 i = 1 n θ i B Φ ( S i ) Τ Φ ( T ) B Φ ( S i ) Τ Φ ( S i ) = ( 1 + β 2 ) P Φ ( S i ) β 2 B Φ ( T ) Τ Φ ( S i ) .
Based on Equations (7), (12) and (14), the solution of B Φ ( S i ) and B Φ ( T ) can be obtained according to the following theorem.
Theorem 1.
The minimization problem in Equation (12) can be converted to the following maximization problem:
min B Φ ( S i ) Τ B Φ ( S i ) = Ι , B Φ ( T ) Τ B Φ ( T ) = Ι G ( B Φ ( S i ) , B Φ ( T ) , P Φ ( S i ) , P Φ ( T ) ) = max B Τ B = Ι t r ( B Τ A B ) ,
where
B = [ B Φ ( T ) B Φ ( S 1 ) B Φ ( S n ) ] , A = [ A 00 A 01 A 0 n A 10 A 11 A 1 n A n 0 A n 1 A n n ]
and
A 00 = 2 Φ ( T ) Φ Τ ( T ) + β 2 2 i = 1 n θ i Φ ( S i ) Φ Τ ( S i ) = 2 K ( T , T ) + β 2 2 i = 1 n θ i K ( S i , S i ) A i i = β 2 θ i 2 2 Φ ( T ) Φ Τ ( T ) + 2 θ i Φ ( S i ) Φ Τ ( S i ) = β 2 θ i 2 2 K ( T , T ) + 2 θ i K ( S i , S i ) A 0 i = A i 0 T = β θ i Φ ( T ) Φ Τ ( T ) + β θ i Φ ( S i ) Φ Τ ( S i ) = β θ i K ( T , T ) + β θ i K ( S i , S i ) A i j = A j i T = β 2 θ i θ j 2 Φ ( T ) Φ Τ ( T ) = β 2 θ i θ j 2 K ( T , T ) , ( i j ) ( i , j = 1 , 2 , , n ) . ,
Proof. 
Based on Equation (7), the optimization problem in Equation (12) can be expressed as:
min B Φ ( S i ) Τ B Φ ( S i ) = Ι , B Φ ( T ) Τ B Φ ( T ) = Ι G ( B Φ ( S i ) , B Φ ( T ) , P Φ ( S i ) , P Φ ( T ) ) = min B Φ ( S i ) Τ B Φ ( S i ) = Ι , B Φ ( T ) Τ B Φ ( T ) = Ι ( 1 + β 2 ) i = 1 n θ i t r ( Φ ( S i ) Φ Τ ( S i ) ) + ( 1 + β 2 ) t r ( Φ Τ ( T ) Φ ( T ) ) 1 2 + β t r ( B Τ A B ) .
as t r ( Φ T ( T ) Φ ( T ) ) and t r ( Φ ( S i ) Φ T ( S i ) ) are constants, and   β [ 0 , 1 ] . Therefore, the minimization problem in Equation (18) can be transformed into the maximization problem in Equation (15).
In addition, the matrix A in Equation (16) is a symmetric matrix (i.e., A T = A ), as:
A T = [ A 00 T A 10 T A n 0 T A 01 T A 11 T A n 1 T A 0 n T A 1 n T A n n T ] = [ A 00 A 01 A 0 n A 10 A 11 A 1 n A n 0 A n 1 A n n ] = A .
According to the following theorem, we can obtain B in Equation (16). □
Theorem 2 (Ky Fan theorem [38]).
Let A denote a symmetric matrix with eigenvalues λ1 ≥ λ2 ≥ ⋯ ≥ λk and corresponding eigenvectors   U = [ u 1 , u 2 , , u k ] . Then,
i = 1 k λ i = max X Τ X = Ι t r ( X Τ A X )
and X = UQ, where Q is an arbitrary orthogonal matrix.
We set Q = I in this paper, and the optimal B consists of the top k eigenvectors of A . The proposed MSHKM algorithm is described in Algorithm 1.
Algorithm 1. MSHKM algorithm
Input: Original target data matrix T; Original source data matrices S 1 , S 2 , , S n ; Similarity parameter β (default as 1); Importance parameter θ i (default as 1 / n ); Dimensions of the new feature space k; Kernel function K ( x , x ) .
Output: Projected target data matrix B Φ ( T ) ;
Projected source data matrices B Φ ( S 1 ) , B Φ ( S 2 ) , , B Φ ( S n ) .
1: Construct the matrix A according to Equations (15) and (16);
2: Calculate the top k eigenvalues of A and the corresponding eigenvectors U = [ u 1 , u 2 , , u k ] ;
3: B Φ ( T ) is the first 1 / ( n + 1 ) rows of U :
B Φ ( T ) = [ U ( 1 , 1 ) U ( 1 , k ) U ( l n + 1 , 1 ) U ( l n + 1 , k ) ] ,
   where l is the number of rows of U ;
4: B Φ ( S i ) is the ( i + 1 ) th 1 / ( n + 1 ) rows of U ;
B Φ ( S i ) = [ U ( i l n + 1 + 1 , 1 ) U ( i l n + 1 + 1 , k ) U ( ( i + 1 ) l n + 1 , 1 ) U ( ( i + 1 ) l n + 1 , k ) ] .
5: Return B Φ ( T ) and B Φ ( S i ) .

4. Experiments

This section provides details of the conducted experiments, including the benchmark data sets, evaluation measures, experimental design, experiment results, statistical significance tests, and effect size tests.

4.1. Benchmark Data Sets

In this paper, a total of 28 data sets, which were both publicly accessible and commonly used, from five distinct projects—NASA [25], SOFTLAB [26], Relink [27], AEEEM [27], and MORPH [28]—were employed as benchmark data sets in the experiments. Each project had a heterogeneous metric set; for example, only one metric was found to be common between NASA and AEEEM, which is the line of code (LOC) metric. The metrics here acted as features and were utilized to extract software defects. Specifically, software metrics can be divided into method-level metrics for procedural-oriented software and class-level metrics for object-oriented software, according to different programming languages. For procedural-oriented software, a method (or function) is usually called a software module, and the measurement object is a single function. In this case, the software metric is called the method-level metric, for example, McCabe metrics [39] and Halstead metrics [40]. For object-oriented software, a class is usually called a software module, and the measurement object is each class; at this time, the software metric is called the class-level metric (also known as object-oriented metric), such as CK metrics [41]. For further details, Table 1 provides a comprehensive list of the data sets used in this research.
The NASA [25] data sets were collected from 11 subsystems, from which we selected 5 of them with 37 metrics, for convenience of comparison with current HDP methods [13]. These data sets contain static code metrics, such as size, readability, and complexity, as well as information about module bugs.
The SOFTLAB [26] data sets, containing 5 subsets, were obtained from a Turkish software company (SOFTLAB). We utilized all SOFTLAB data sets in the PROMISE repository. Both SOFTLAB and NASA have 28 common metrics, including McCabe and Halstead metrics, but SOFTLAB has no complexity metrics that are included in NASA.
The Relink [27] data sets contain defect information from three open-source projects, and include 26 code complexity metrics for each project.
The AEEEM [28] data sets include information about five Java projects, consisting of 61 metrics, including process metrics, previous defects, source code metrics, entropy of changes, churn of source code metrics, and entropy of source code metrics, for each project.
The MORPH [29] data sets were utilized to deal with privacy problems for defect prediction, which contain several open-source projects and include 20 metrics, such as McCabe metrics and CK metrics.

4.2. Evaluation Measures

For the purpose of assessing the efficacy of our method, three widely recognized performance metrics, namely Pd (recall rate), Pf (false positive rate), and GM (Geometric mean), were applied. These metrics can be characterized in relation to the confusion matrix [42], which consists of the number of predicted outcomes of TP (true positive), FP (false positive), TN (true negative), and FN (false negative), as detailed in Table 2.
Here, TP refers to the number of instances predicted as buggy that were actually buggy, FP represents the number of instances predicted as buggy that were actually clean, TN denotes the number of instances predicted as clean that were actually clean, and FN represents the number of instances predicted as clean that were actually buggy.
Pd denotes the proportion of actual buggy instances that were correctly predicted as buggy; higher values of Pd indicate better prediction performance. Pf represents the proportion of actual clean instances that were incorrectly predicted as buggy. GM is the geometric mean of Pd and 1−Pf, which provides an evaluation measure for classifiers that deal with imbalanced data sets. All evaluation measures employed in our experiment range from 0 to 1. For details of the evaluation measures, see Table 3.

4.3. Experimental Design

The present study aims to address the following four research questions:
  • RQ1. Which strategy is preferable for multi-source HDP?
  • RQ2. How many source projects applied in MSHKM can achieve the optimal prediction performance?
  • RQ3. Does MSHKM outperform existing HDP methods in terms of prediction performance?
  • RQ4. Does MSHKM outperform WPDP in terms of prediction performance?
To conduct our research, 28 data sets from five projects were employed as experimental data for performing HDP. In each turn of the experiment, one data set was designated as a target data set, while other data sets from different projects were employed as source data sets. For example, when we selected ant1.3 in MORPH as the target data set, then, 18 data sets from other projects (NASA, SOFTLAB, Relink, and AEEEM) were used as source data sets. Before performing the MSHKM, the general over-sampling method SMOTE was applied to pre-process all data sets. The number of new samples was set as 500, with 250 samples for both positive and negative samples. To ensure fairness, the logistic regression (LR) classifier was used for all baseline algorithms. We also used 90% of the sample as training data, and repeated the process 20 times in each round.
For RQ1 and RQ2, we compared the performance measures under different values of n in MSHKM for the two strategies, where n represents the number of source projects. Each time, we chose I (i ∈ [1, n], i = 1, 2, 4, 8, 12, 16) source projects randomly from the source projects chosen for the experiments, with the aim of determining a better appropriate number of source projects for MSHKM. Note that the maximum value of cross-project data sets for NASA, SOFTLAB, and AEEEM was 23 (28 − 5), while that for MORPH was 18 (28 − 10). For MSHKM, we set β = 1 and θi = 1/n in Strategy 1 and β = 1 and θi = 1 in Strategy 2 by default. Meanwhile, k was set equal to the number of available eigenvalues, for which the value was not less than 0.001.
For RQ3, three HDP methods, including CCA+ [10], HDP-KS [9], CTKCCA [13], and one multi-source HDP method, named MHCPDP [21], were chosen as baselines. Another method for multi-source HDP, named MSMDA [35], was excluded as a baseline, as its results were no better than CTKCCA when compared in [33]. The best results obtained for MSHKM were selected when assessing RQ1 and RQ2 (i.e., the better strategy and the optimal number of the source projects n). We used similar experimental settings and compared our results with those provided in reference [13].
For RQ4, we compared MSHKM with WPDP. During the WPDP experiment, it was necessary to split each data set into training and test parts. To assess the efficacy of the defect prediction model, five-fold cross validation was used. During each round of five-fold cross validation, one fold served as the test set, whereas the other four were used for training. Note that we used different folds as training sets during the same round. Therefore, five tests were conducted as one round, and there were, totally, 100 rounds (i.e., 500 tests).
To implement CCA+, HDP-KS, CTKCCA, MHCPDP, and WPDP, we employed Python programming, followed the prescribed settings outlined in their respective papers. We applied Z-score normalization to all data sets prior to executing these algorithms, as it is widely utilized in the field of software defect prediction [10,13,15,16,17,18,19,21,43]. For the kernel function in MSHKM, the Gaussian kernel function was used. If MSHKM obtained better prediction results than CCA+, HDP-KS, CTKCCA, MHCPDP, and WPDP methods, then, the conclusion is that MSHKM can effectively improve the performance of the prediction model in the scenario of HDP.

5. Results

The average outcomes with different n applied to MSHKM under the two strategies, in terms of Pd, Pf, and GM, for each target project is presented. The results are given in Appendix A, where, n represents the number of source projects, ranging from 1 to 23/18. Strategy 1 is abbreviated as Str. 1, while strategy 2 is abbreviated as Str. 2. It can be noted that the results under strategy 1 and strategy 2 were the same when n = 1, as, for single-source HDP, the two strategies are equivalent. The result trends of the two strategies with different numbers of source projects are depicted in Figure 5, Figure 6 and Figure 7.
From these tables and figures, we can obviously observe that the values obtained under strategy 2 are better than those under strategy 1, in terms of Pd, Pf, and GM, which provides an answer to RQ1. In addition, the figures also show the tendencies of Pd, Pf, and GM; that is, for Pd and GM, the values decrease with increasing n, while the opposite occurs for Pf when using strategy 1. However, under strategy 2, the values increase with an increase in n, up to n = 4, for Pd and GM, while the opposite occurs for Pf, after which it levels off. Overall, the best results were achieved when n = 1 under strategy 1, and with n > 2 under strategy 2. From the above, we can answer RQ2: the fewer source projects applied in MSHKM under strategy 1, the better the prediction performance; when using just one source project each time, we can achieve the best prediction performance. However, under strategy 2, when the number of source projects is less than or equal to 4, the higher the number of source projects, the better the prediction performance, after which the performance becomes stable. For Pf and GM, the best value is achieved when n = 4. Although the best value for Pd is not achieved when n = 4, it serves as a turning point towards stability. In order to save time in model training, a smaller number of training sets should be selected when the prediction effect is similar.
Based on the above experimental results, we can draw the following conclusion. Both of our proposed two strategies, combined with MSHKM, can solve the problem of multi-source HDP. However, the predicted performance of strategy 1 becomes worse with the increase of the number of source projects, while strategy 2 is on the contrary. For strategy 1, n = 1 is the best, and, for strategy 2, n = 4 is the best. In general, in the multi-source heterogeneous scenario, strategy 2 is the better choice.
Table 4, Table 5 and Table 6 provide the mean values of Pd, Pf, and GM, respectively, when using five different methods for each target project. It can be seen that the results of MSHKM provided the best values when n = 4 under strategy 2. The best values for each target project are labeled in bold font, and a value with a dark gray background indicates a significant improvement, whether MSHKM is better than baselines or vice versa. For the meanings of other backgrounds, refer to the notes in Table 4. From these tables, we can see that the mean values of MSHKM in Pd and GM are higher than those of the baselines, while the Pf values are lower; in other words, MSHKM achieved better results than the other methods. At the same time, the performance of MSHKM was improved by 50.57%, 78.73%, and 43.61%, in terms of Pd, Pf, and GM, respectively, when compared to MHCPDP. Moreover, our MSHKM exceeded WPDP by 17.09%, 65.46%, and 16.65% in Pd, Pf, and GM, respectively. In addition, the numbers and medians of the best results (described in bold font) for each method are summarized in Table 7. We can see the counts of the best results for MSHKM, in terms of Pd and GM, were higher than the other four methods, except, however, for Pf, where CTKCCA achieved a higher result. The medians of the best results for each method are also provided, from which it can be noted that the medians of the best results for WPDP and CTKCCA were better than those for MSHKM. These results indicate that WPDP and CTKCCA can perform better than MSHKM in some of the data sets. However, most of the results obtained by WPDP and CTKCCA were unsatisfying.
Additionally, Figure 8, Figure 9 and Figure 10 show the boxplots of results of WPDP, CCA+, HDP-KS, CTKCCA, MHCPDP, and MSHKM, in terms of Pd, Pf, and GM, respectively. The plots show that MSHKM had the highest mean values for Pd and GM, as well as the lowest mean values for Pf. Moreover, according to the distribution in the figures, the effect of MSHKM was more stable than those of the other five methods.
According to the above results, we can answer RQ2 and RQ3. For RQ2, the number of best results for MSHKM was higher than that for CCA+, HDP-KS, CTKCCA, and MHCPDP, except for the Pf of CTKCCA. However, all mean values of MSHKM were better than those of CTKCCA. This suggests that MSHKM performs better and is more stable than CTKCCA. For RQ3, both the numbers of best results and mean values of MSHKM were higher than those of WPDP.
Based on the above experimental results, we can draw the following conclusion. The proposed MSHKM is superior to the existing HDP method, including CCA+, HDP-KS, and CTKCCA. In addition, MSHKM significantly outperforms the multiple-source HDP method, MHCPDP, and improves by at least 50.57%, 78.73%, and 43.61%, in terms of Pd, Pf, and GM, respectively. Moreover, MSHKM outperforms WPDP and improves by 17.09%, 65.46%, and 16.65%, in terms of Pd, Pf, and GM, respectively.

6. Statistical Testing

6.1. Statistical Significance Test

To assess the statistical significance of the predicting Pd, Pf, and GM, we conducted the non-parametric Friedman test with a post-hoc Nemenyi test at a 95% confidence level when comparing WPDP, CCA+, HDP-KS, CTKCCA, MHCPDP, and MSHKM over the 28 data sets [44]. The Friedman test compares whether the average ranks have statistical significance, and has been previously applied in heterogeneous CPDP studies [9,13]. We ranked the values of different methods for each data set to 6, 5, 4, 3, 2, and 1, from large to small, according to Table 4, Table 5 and Table 6; for example, the ranks of five methods for Apache were 5 (WPDP), 1 (CCA+), 2 (HDP-KS), 4 (CTKCCA), 3 (MHCPDP), and 6 (MSHKM), in terms of Pd, according to Table 4, Table 5 and Table 6. It is worth noting that a rank of 6 represents the best result for Pd and GM, but represents the worst result for Pf. The results of the Friedman test, reported in Table 8, demonstrated mean rank of each method, and the p-values are far less than 0.001. To further analyze these results, we employed the Nemenyi test, which graphically visualize the comparison results for Pd, Pf, and GM in Figure 11, Figure 12 and Figure 13, respectively. Specifically, the critical difference (CD) was used to connect methods without significant differences. In other words, there is no significant difference in the methods of connection [44].
In terms of the Pd mean ranks shown in Figure 11, there were four groups: {MSHKM, WPDP}, {WPDP, CTKCCA}, {CTKCCA, MHCPDP}, and {MHCPDP, CCA+, HDP-KS}. The inner methods of each group are connected. It should be noted that a higher mean rank (the left side in the axis) represents better prediction performance, which is also suitable for GM. However, for Pf, the right side indicates better performance. From Figure 10 and Figure 11, we can see that MSHKM outperformed CTKCCA, MHCPDP, CCA+, and HDP-KS significantly for Pd and Pf, but did not significantly outperform WPDP, as they were in the same group. Similarly, for GM, from Figure 13, we can observe that MSHKM outperformed the other five baselines with significant differences.
Overall, MSHKM provided better performance against the HDP baselines and showed comparable results when compared to WPDP, with statistical significance in Pd, Pf, and GM comparisons.

6.2. Effect Size Test

Furthermore, to measure the magnitude of the difference between MSHKM and baselines, we performed a non-parametric Cliff’s delta (δ) effect size test [45]. Cliff’s delta estimates the probability that a result value from one method is greater than one from another, which is measured in the closed interval [−1, 1]. The effect size of 1 or −1 indicates no overlap between two methods, whereas, a value of 0 indicates complete overlap between two distributions. We applied the evaluation standard of effect size, as described in Table 9 [46].
The background of Table 4, Table 5 and Table 6 shows the results of the Cliff’s delta. A cell with a dark gray background suggests that MSHKM provides a considerably significant improvement over the corresponding method, a medium gray background indicates that MSHKM provides a moderately significant improvement, and a light gray background indicates that MSHKM provides a small significant improvement. For a clearer comparison of the results for the effect size, we counted the number of projects in each effectiveness level, and reported the results in Table 10. From Table 10, we can see the number at the L level was always higher than the others. This indicates that MSHKM can achieve large performance improvements, compared to the other four methods (except for CTKCCA in Pf).

7. Discussion

The MSHKM method proposed in this paper can effectively improve the performance of HDP. However, there are several problems and potential threats to the validity of our empirical study.
Firstly, this article deals with the problem of heterogeneous feature space of different projects and proposes two strategies. However, two strategies have different time complexities for the MSHKM algorithm. Assuming there are n source projects, and each matrix has a dimension of m × m , the complexity for strategy 2 is O( n m 3 ), while strategy 1 requires O( n 3 m 3 ). Therefore, for situations with fewer source projects, it is better to choose the more effective strategy, while, for situations with a large number of source projects, the time cost should be considered, and strategy 2 should be chosen as much as possible. Regardless of which strategy is used, the algorithm’s complexity will increase with an increase in the number of source projects, which is the main disadvantage of this paper.
For performance measures, we used Pd (also known as recall), Pf, and GM to evaluate the performance of all methods, as they are commonly used performance measures in software defect prediction, especially on the baseline methods used in this paper. Additional comprehensive performance measures, such as AUC [9], Matthews correlation coefficient (MCC) [47,48], and balance [49], were not used. However, we intend to use such measures for specific problems as future work, such as using AUC to evaluate classifiers without fixed thresholds. It should be noted that F1 was excluded, as it is biased and not suitable in the presence of the class imbalance problem [47,48]. Similarly, precision is not used because it is also be affected by the imbalance of category distribution. In the case of class imbalance, the classifier may tend to predict the class with a large proportion, resulting in a high value of precision. Accuracy is also a metric leading to misleading results. For example, when 95% of samples are positive samples, as long as the classifier classifies all samples as positive samples, the accuracy can still be 0.95, but the performance of the model may not be good, as the model cannot predict negative samples.
For the classifier, we employed logistic regression (LR) for all experiments in this paper, since it has been successfully and commonly used in prior HDP research [9,14,15,16,17,18,34,35]. Moreover, the LR classifier does not require parameter setting and hyperparameter adjustment, thus avoiding additional computational costs [43]. In addition, LR classification techniques tend to produce top-performing classifiers in software defect prediction [16,50]. Despite the above reasons, other classifiers still need to be compared on the basis of the novel MSHKM algorithm. Therefore, the selection of a more suitable classifier for use with MSHKM will also be considered as future work.
In addition, with regard to the θ of MSHKM, we set θ i = 1/n by default. According to our experimental results, we achieved the best results when n = 1 in strategy 1, and n = 4 in strategy 2 (i.e., θ i = 1 or θ i = ¼). In fact, θ i is a changeable parameter, in terms of the correlations between different data sets. For example, when we chose CM1 as the target project, MW1 is more similar than EQ as a source project, when compared with CM1. As a result, it is reasonable that the θ value of MW1 should be larger than that of EQ. At the same time, the selection of source projects in RQ2 is random, which is unstable. If the similarity between source and target projects can be determined, the source projects can be selected according to the similarity, which may allow for better and more reasonable results to be obtained. More importantly, θ i can be re-defined, based on the similarity between the source and target projects. Therefore, the similarity between heterogeneous data and the θ i values in MSHKM can be studied as future work.

8. Conclusions

HDP is an efficient technique for constructing a suitable defect prediction model when the source and target projects have heterogeneous metrics, potentially decreasing the data cost of the target project, and enhancing the efficiency of software testing, as well as improving software quality.
In this paper, we presented a new multi-source heterogeneous kernel mapping (MSHKM) algorithm for HDP. To analyze the effects of multiple-source projects on the prediction results, two strategies, based on MSHKM, for multi-source HDP were proposed. In addition, the number of source projects in each experiment was changed to determine the rules that affect the prediction performance. Furthermore, we compared the proposed MSHKM with existing HDP methods, including CCA+, HDP-KS, CTKCCA, and MHCPDP, as well as comparing MSHKM with WPDP.
Experiments were performed on 28 data sets from five widely used projects, using three common measures to evaluate the considered methods. We further evaluated the experimental results by performing a non-parametric Friedman test with the Nemenyi post hoc test and the Cliff’s delta effect size test. The experimental results demonstrated that (1) in the multi-source HDP scenario, strategy 2 is superior to strategy 1; (2) for MSHKM, the lower the number of source projects, the better the results obtained under strategy 1, while n = 4 was the optimal number for strategy 2; (3) MSHKM can outperform state-of-the-art HDP methods; and (4) MSHKM also performs better than WPDP. From the above, it can be stated that the proposed MSHKM approach may improve software quality obviously, as well as decreasing both time and human costs.
For future work, we plan to employ other effective classifiers and evaluation measures for comparison. Additionally, the similarity between heterogeneous source and target projects will also be studied to optimize source project selection, as well as the weight parameters for multi-source projects in the MSHKM algorithm.

Author Contributions

Conceptualization, Y.W. and J.Y.; methodology, J.Y.; software, J.Y.; validation, J.Y.; formal analysis, J.Y.; investigation, J.Y.; resources, J.Y.; data curation, J.Y.; writing—original draft preparation, J.Y. and Z.L.; writing—review and editing, Y.W.; visualization, J.Y.; supervision, B.L.; project administration, Y.W.; funding acquisition, B.L. All authors have read and agreed to the published version of the manuscript.

Funding

This research was funded by National defense research foundation of China, grant number JZX7Y20220142200501.

Institutional Review Board Statement

Not applicable.

Informed Consent Statement

Not applicable.

Data Availability Statement

Data used in this article is publicly available data. Information about the data is contained within the text.

Conflicts of Interest

We declare that we have no financial and personal relationships with other people or organizations that can inappropriately influence our work, there is no professional or other personal interest of any nature or kind in any product, service and/or company that could be construed as influencing the position presented in, or the review of, the manuscript entitled.

Appendix A

Table A1. Results for Pd under a varying number of source projects n between two strategies in MSHKM.
Table A1. Results for Pd under a varying number of source projects n between two strategies in MSHKM.
Targetn = 1n = 2n = 4n = 8n = 12n = 16n = 23/18
Str. 1&2Str. 1Str. 2Str. 1Str. 2Str. 1Str. 2Str. 1Str. 2Str. 1Str. 2Str. 1Str. 2
CM10.8630.8600.969 0.8110.935 0.7370.933 0.6710.909 0.6410.928 0.6070.954
MW10.8550.8500.922 0.7990.923 0.7230.938 0.6580.941 0.6410.969 0.5940.926
PC10.8740.8430.892 0.7980.915 0.7190.926 0.6620.928 0.6210.925 0.5810.928
PC30.8800.8680.919 0.7940.937 0.7390.948 0.6660.923 0.6350.921 0.6050.931
PC40.8950.8870.939 0.8070.950 0.7030.905 0.6590.962 0.6130.925 0.5900.938
AR10.9370.9280.876 0.8470.875 0.7400.906 0.6620.923 0.5970.926 0.5710.928
AR30.8860.8620.922 0.8280.871 0.7500.868 0.6720.894 0.6130.749 0.5980.875
AR40.8910.8650.966 0.8290.943 0.7330.962 0.6740.913 0.6060.942 0.5650.994
AR50.9670.9500.911 0.9090.864 0.7460.871 0.6170.884 0.5780.856 0.5000.873
AR60.9420.9100.951 0.8320.965 0.7540.947 0.6680.930 0.6230.984 0.5590.937
Apache0.8480.8250.897 0.7900.958 0.7300.948 0.6830.902 0.6490.916 0.6020.930
Safe0.9290.8950.944 0.8680.935 0.7320.956 0.6600.948 0.6220.932 0.5640.953
ZXing0.8160.8160.834 0.7890.908 0.7290.967 0.6900.987 0.6730.981 0.6320.976
EQ0.8970.8760.910 0.8230.940 0.7380.956 0.6790.978 0.6420.960 0.5980.948
JDT0.8870.8440.892 0.8070.972 0.7520.962 0.6860.952 0.6540.932 0.6140.947
LC0.9250.8970.950 0.8340.934 0.7530.944 0.6820.951 0.6260.945 0.5950.948
ML0.8720.8800.903 0.8360.939 0.7340.924 0.6820.919 0.6380.876 0.6020.912
PDE0.8800.8630.966 0.7970.969 0.7310.950 0.6760.947 0.6570.952 0.6090.961
ant1.30.8730.8610.901 0.8070.959 0.7220.952 0.6740.955 0.6440.953 0.6400.945
arc0.8580.8460.860 0.7900.911 0.7300.943 0.6770.973 0.6470.958 0.6360.957
camel1.00.8160.8410.824 0.8030.931 0.7410.944 0.6950.963 0.6660.953 0.6570.942
poi1.50.8930.8570.937 0.8010.927 0.7210.936 0.6820.951 0.6450.954 0.6300.956
redaktor0.8870.8560.966 0.8290.904 0.7180.890 0.6720.900 0.6390.869 0.6280.821
skarbonka0.9140.8940.915 0.8220.924 0.7570.941 0.6270.892 0.5690.982 0.5560.956
tomcat0.8870.8220.937 0.8030.959 0.7110.928 0.6680.935 0.6350.962 0.6250.935
Velocity1.40.9100.8900.934 0.8450.947 0.7410.949 0.6610.989 0.6380.955 0.6130.955
Xalan2.40.8890.8370.928 0.7890.934 0.7270.928 0.6750.959 0.6410.965 0.6330.965
Xerces1.20.8250.8180.871 0.7580.955 0.7060.945 0.6750.969 0.6440.945 0.6300.941
Ave.0.886 0.866 0.916 0.816 0.932 0.733 0.935 0.670 0.938 0.632 0.933 0.601 0.937
Std.0.036 0.033 0.038 0.029 0.028 0.014 0.0250.017 0.030 0.024 0.048 0.033 0.034
Table A2. Results for Pf under a varying number of source projects n between two strategies in MSHKM.
Table A2. Results for Pf under a varying number of source projects n between two strategies in MSHKM.
Targetn = 1n = 2n = 4n = 8n = 12n = 16n = 23/18
Str. 1&2Str. 1Str. 2Str. 1Str. 2Str. 1Str. 2Str. 1Str. 2Str. 1Str. 2Str. 1Str. 2
CM10.1150.1230.0940.2010.037 0.2530.0780.3100.0840.3390.0810.3760.078
MW10.0990.1190.0860.1740.012 0.2590.0620.3080.0690.3460.0740.3770.068
PC10.0920.1260.1080.1750.075 0.2580.0960.3140.0920.3520.0890.3940.094
PC30.1160.1240.0890.1860.029 0.2570.0640.3190.0590.3480.0600.3830.062
PC40.1090.1260.1120.1830.056 0.2680.0650.3220.0620.3580.0590.3880.078
AR10.1000.1230.0920.1860.091 0.2890.1080.3410.0980.3650.1030.4120.110
AR30.0660.0960.0780.1400.084 0.2580.0580.3530.0540.3950.0590.4280.062
AR40.1030.1180.1220.1750.073 0.2650.1090.3310.1180.3630.1170.4060.108
AR50.0640.0610.0870.0990.130 0.2410.0840.3790.0760.4260.1020.4880.086
AR60.1110.1150.0770.1860.235 0.2870.0980.3410.1010.3770.0750.4150.098
Apache0.1140.1420.1010.1830.109 0.2640.0960.3000.0910.3390.1020.3800.084
Safe0.0870.1340.0980.1680.069 0.2850.0920.3550.0960.4000.0840.4410.087
ZXing0.1660.1660.0950.2190.112 0.2520.1370.3020.1190.3140.1060.3530.095
EQ0.0860.1110.0760.1670.050 0.2520.0700.3220.0660.3560.0680.3970.072
JDT0.1290.1430.0940.1830.062 0.2490.0590.3190.0680.3440.0590.3740.063
LC0.1150.1290.1110.1830.062 0.2740.0870.3310.0930.3650.0910.4070.100
ML0.1000.1210.0810.1670.037 0.2620.0630.3190.0670.3650.0690.4040.068
PDE0.1180.1510.1160.1960.035 0.2730.0890.3070.0930.3380.0790.3790.086
ant1.30.1380.1460.0730.1810.051 0.2500.0700.2960.0620.3250.0680.3420.067
arc0.1120.1240.0850.1710.042 0.2480.0750.3070.0740.3270.0780.3450.071
camel1.00.1600.1590.0940.1880.118 0.2500.0790.2810.0880.3100.0870.3190.075
poi1.50.1500.1700.1240.1840.002 0.2630.0780.3120.0790.3430.0840.3520.078
redaktor0.1030.1010.1140.1580.031 0.2500.1100.3200.0990.3510.0940.3670.106
skarbonka0.0910.1040.0690.1820.060 0.2980.0670.3590.0680.4050.0590.4180.069
tomcat0.0930.1350.1010.1710.051 0.2490.0790.3010.0730.3350.0730.3420.078
Velocity1.40.1190.1540.0820.1930.124 0.2830.0690.3410.0680.3800.0740.3970.078
Xalan2.40.1130.1420.0960.1780.015 0.2460.0680.2930.0740.3250.0760.3370.074
Xerces1.20.1410.1320.1270.1860.019 0.2420.1120.2910.1090.3230.1160.3300.109
Ave.0.111 0.128 0.0960.177 0.067 0.262 0.083 0.321 0.082 0.354 0.082 0.384 0.082
Std.0.024 0.023 0.0160.021 0.019 0.015 0.020 0.023 0.018 0.028 0.017 0.037 0.015
Table A3. Results for GM under a varying number of source projects n between two strategies in MSHKM.
Table A3. Results for GM under a varying number of source projects n between two strategies in MSHKM.
Targetn = 1n = 2n = 4n = 8n = 12n = 16n = 23/18
Str. 1&2Str. 1Str. 2Str. 1Str. 2Str. 1Str. 2Str. 1Str. 2Str. 1Str. 2Str. 1Str. 2
CM10.8730.8670.9370.8040.949 0.7410.956 0.6790.945 0.6500.937 0.6140.958
MW10.8780.8650.9180.8120.955 0.7310.939 0.6740.951 0.6460.956 0.6070.953
PC10.8900.8580.8920.8110.920 0.7300.927 0.6730.926 0.6330.924 0.5930.922
PC30.8810.8720.9150.8040.954 0.7410.959 0.6730.947 0.6430.943 0.6110.943
PC40.8930.8800.9130.8110.947 0.7160.939 0.6680.942 0.6270.927 0.6000.934
AR10.9170.9010.8920.8280.892 0.7220.892 0.6560.956 0.610 0.914 0.5730.924
AR30.9080.8820.9220.8400.893 0.7410.884 0.6520.899 0.6030.867 0.5770.886
AR40.8930.8720.9210.8260.935 0.7320.913 0.6690.929 0.6190.913 0.5770.908
AR50.9510.9440.9120.9030.867 0.7480.846 0.6120.829 0.5650.849 0.4930.848
AR60.9140.8970.9370.8220.859 0.7320.891 0.6610.901 0.620 0.852 0.5690.863
Apache0.8660.8400.8980.8020.924 0.7320.921 0.6900.924 0.6530.921 0.6090.928
Safe0.9200.8790.9230.8470.933 0.7200.935 0.6500.912 0.6080.922 0.5580.923
ZXing0.8240.8240.8690.7840.898 0.7380.883 0.6930.908 0.6780.910 0.6380.902
EQ0.9050.8820.9170.8270.945 0.7420.937 0.6780.945 0.6430.957 0.6000.955
JDT0.8780.8500.8990.8110.955 0.7510.956 0.6830.956 0.6540.964 0.6190.963
LC0.9050.8830.9190.8250.936 0.7390.934 0.6750.937 0.630 0.945 0.5930.939
ML0.8850.8790.9110.8340.951 0.7350.928 0.6810.939 0.6360.919 0.5980.925
PDE0.8800.8550.9240.8000.967 0.7280.963 0.6840.964 0.6590.966 0.6150.961
ant1.30.8670.8570.9140.8120.954 0.7350.956 0.6880.952 0.6580.948 0.6480.936
arc0.8720.8590.8870.8080.934 0.7400.936 0.6840.928 0.6590.939 0.6440.945
camel1.00.8260.8400.8640.8060.906 0.7450.904 0.7050.906 0.6770.906 0.6680.908
poi1.50.8710.8430.9060.8080.962 0.7280.964 0.6830.958 0.650 0.963 0.6370.972
redaktor0.8910.8760.9250.8350.936 0.7320.933 0.6750.910 0.6420.936 0.6290.927
skarbonka0.9100.8940.9230.8180.932 0.7270.929 0.6290.878 0.5740.881 0.5620.855
tomcat0.8960.8430.9180.8150.954 0.7300.956 0.6830.941 0.6490.968 0.6410.958
Velocity1.40.8940.8670.9260.8240.911 0.7280.897 0.6590.911 0.6270.905 0.6060.880
Xalan2.40.8870.8470.9160.8040.959 0.7390.957 0.6900.969 0.6570.969 0.6470.969
Xerces1.20.8410.8420.8720.7850.968 0.7300.973 0.6900.981 0.6590.978 0.6490.973
Ave.0.886 0.868 0.9100.818 0.932 0.734 0.929 0.673 0.930 0.637 0.928 0.606 0.927
Std.0.027 0.024 0.0190.022 0.029 0.008 0.031 0.020 0.031 0.027 0.035 0.037 0.035

References

  1. Fenton, N.E.; Neil, M. A critique of software defect prediction models. IEEE Trans. Softw. Eng. 2002, 25, 675–689. [Google Scholar] [CrossRef]
  2. Shao, Y.; Liu, B.; Wang, S.; Li, G. A novel software defect prediction based on atomic class-association rule mining. Expert Syst. Appl. 2018, 114, 237–254. [Google Scholar] [CrossRef]
  3. Shao, Y.; Liu, B.; Wang, S.; Li, G. Software defect prediction based on correlation weighted class association rule mining. Knowl.-Based Syst. 2020, 196, 105742. [Google Scholar] [CrossRef]
  4. Tong, H.; Liu, B.; Wang, S. Software defect prediction using stacked denoising autoencoders and two-stage ensemble learning. Inf. Softw. Technol. 2018, 96, 94–111. [Google Scholar] [CrossRef]
  5. Zimmermann, T.; Nagappan, N.; Gall, H.; Giger, E.; Murphy, B. Cross-project defect prediction: A large scale experiment on data vs. domain vs. process. In Proceedings of the Joint 12th European Software Engineering Conference and 17th ACM SIGSOFT Symposium on the Foundations of Software Engineering (ESEC-FSE’09), Amsterdam, The Netherlands, 24–29 August 2009; pp. 91–100. [Google Scholar]
  6. Qiu, S.; Lu, L.; Cai, Z.; Jiang, S. Cross-project defect prediction via transferable deep learning-generated and handcrafted features. In Proceedings of the 31st International Conference on Software Engineering and Knowledge Engineering (SEKE 2019), Lisbon, Portugal, 10–12 July 2019; Knowledge Systems Institute Graduate School: Skokie, IL, USA, 2019; pp. 431–436. [Google Scholar]
  7. Herbold, S.; Trautsch, A.; Grabowski, J. Global vs. local models for cross-project defect prediction. Empir. Softw. Eng. 2016, 22, 1866–1902. [Google Scholar] [CrossRef]
  8. Xiao, P.; Liu, B.; Wang, S. Feedback-based integrated prediction: Defect prediction based on feedback from software testing process. J. Syst. Softw. 2018, 143, 159–171. [Google Scholar] [CrossRef]
  9. Nam, J.; Kim, S. Heterogeneous Defect Prediction. IEEE Trans. Softw. Eng. 2018, 44, 874–896. [Google Scholar] [CrossRef]
  10. Jing, X.; Wu, F.; Dong, X.; Qi, F.; Xu, B. Heterogeneous cross-company defect prediction by unified metric representation and CCA-based transfer learning. In Proceedings of the 2015 10th Joint Meeting on Foundations of Software Engineering, Bergamo, Italy, 30 August–4 September 2015; pp. 496–507. [Google Scholar]
  11. Cheng, M.; Wu, G.; Jiang, M.; Wan, H.; You, G.; Yuan, M. Heterogeneous Defect Prediction via Exploiting Correlation Subspace. In Proceedings of the SEKE, Redwood City, CA, USA, 1–3 July 2016; pp. 171–176. [Google Scholar]
  12. Ma, Y.; Zhu, S.; Chen, Y.; Li, J. Kernel CCA based transfer learning for software defect prediction. IEICE Trans. Inf. Syst. 2017, 100, 1903–1906. [Google Scholar] [CrossRef]
  13. Li, Z.; Jing, X.Y.; Wu, F.; Zhu, X.; Xu, B.; Ying, S. Cost-sensitive transfer kernel canonical correlation analysis for heterogeneous defect prediction. Autom. Softw. Eng. 2018, 25, 201–245. [Google Scholar] [CrossRef]
  14. Yu, Q.; Jiang, S.; Zhang, Y. A feature matching and transfer approach for cross-company defect prediction. J. Syst. Softw. 2017, 132, 366–378. [Google Scholar] [CrossRef]
  15. Li, Z.; Jing, X.Y.; Zhu, X.; Zhang, H. Heterogeneous defect prediction through multiple kernel learning and ensemble learning. In Proceedings of the IEEE International Conference on Software Maintenance and Evolution (ICSME), Shanghai, China, 17–22 September 2017; pp. 91–102. [Google Scholar]
  16. Li, Z.; Jing, X.Y.; Zhu, X.; Zhang, H.; Xu, B.; Ying, S. Heterogeneous defect prediction with two-stage ensemble learning. Autom. Softw. Eng. 2019, 26, 599–651. [Google Scholar] [CrossRef]
  17. Tong, H.; Liu, B.; Wang, S. Kernel Spectral Embedding Transfer Ensemble for Heterogeneous Defect Prediction. IEEE Trans. Softw. Eng. 2021, 47, 1886–1906. [Google Scholar] [CrossRef]
  18. Xu, Z.; Yuan, P.; Zhang, T.; Tang, Y.; Li, S.; Xia, Z. HDA: Cross-project defect prediction via heterogeneous domain adaptation with dictionary learning. IEEE Access 2018, 6, 57597–57613. [Google Scholar] [CrossRef]
  19. Xu, Z.; Ye, S.; Zhang, T.; Xia, Z.; Pang, S.; Wang, Y.; Tang, Y. Mvse: Effort-aware heterogeneous defect prediction via multiple-view spectral embedding. In Proceedings of the IEEE 19th International Conference on Software Quality, Reliability and Security (QRS), Sofia, Bulgaria, 22–26 July 2019; pp. 10–17. [Google Scholar]
  20. Gong, L.; Jiang, S.; Yu, Q.; Jiang, L. Unsupervised deep domain adaptation for heterogeneous defect prediction. IEICE Trans. Inf. Syst. 2019, 102, 537–549. [Google Scholar] [CrossRef]
  21. Wu, J.; Wu, Y.; Niu, N.; Zhou, M. MHCPDP: Multi-source heterogeneous cross-project defect prediction via multi-source transfer learning and autoencoder. Softw. Qual. J. 2021, 29, 405–430. [Google Scholar] [CrossRef]
  22. Wang, A.; Zhang, Y.; Wu, H.; Jiang, K.; Wang, M. Few-shot learning based balanced distribution adaptation for heterogeneous defect prediction. IEEE Access 2020, 8, 32989–33001. [Google Scholar] [CrossRef]
  23. Zong, X.; Li, G.; Zheng, S.; Zou, H.; Yu, H.; Gao, S. Heterogeneous cross-project defect prediction via optimal transport. IEEE Access 2023, 11, 12015–12030. [Google Scholar] [CrossRef]
  24. Shi, X.; Liu, Q.; Fan, W.; Yu, P.S. Transfer across completely different feature spaces via spectral embedding. IEEE Trans. Knowl. Data Eng. 2011, 25, 906–918. [Google Scholar]
  25. Shepperd, M.; Song, Q.; Sun, Z.; Mair, C. Data quality: Some comments on the NASA software defect datasets. IEEE Trans. Softw. Eng. 2013, 39, 1208–1215. [Google Scholar] [CrossRef]
  26. Turhan, B.; Menzies, T.; Bener, A.B.; Di Stefano, J. On the relative value of cross-company and within-company data for defect prediction. Empir. Softw. Eng. 2009, 14, 540–578. [Google Scholar] [CrossRef]
  27. Wu, R.; Zhang, H.; Kim, S.; Cheung, S.C. Relink: Recovering links between bugs and changes. In Proceedings of the 19th ACM SIGSOFT Symposium and the 13th European Conference on Foundations of Software Engineering, Szeged, Hungary, 5–9 September 2011; pp. 15–25. [Google Scholar]
  28. D’Ambros, M.; Lanza, M.; Robbes, R. Evaluating defect prediction approaches: A benchmark and an extensive comparison. Empir. Softw. Eng. 2012, 17, 531–577. [Google Scholar] [CrossRef]
  29. Peters, F.; Menzies, T. Privacy and utility for defect prediction: Experiments with morph. In Proceedings of the 2012 34th International conference on software engineering (ICSE), Zurich, Switzerland, 2–9 June 2012; IEEE: New York, NY, USA, 2012; pp. 189–199. [Google Scholar]
  30. Wu, H.; Ng, M.K. Multiple graphs and low-rank embedding for multi-source heterogeneous domain adaptation. ACM Trans. Knowl. Discov. Data 2022, 16, 1–25. [Google Scholar] [CrossRef]
  31. Chai, L.; Xu, H.; Luo, Z.; Li, S. A multi-source heterogeneous data analytic method for future price fluctuation prediction. Neurocomputing 2020, 418, 11–20. [Google Scholar] [CrossRef]
  32. Zhao, W.; Fu, Z.; Fan, T.; Wang, J. Ontology construction and mapping of multi-source heterogeneous data based on hybrid neural network and autoencoder. Neural Comput. Appl. 2023, 1–11. [Google Scholar] [CrossRef]
  33. Chen, H.; Jing, X.Y.; Li, Z.; Wu, D.; Peng, Y.; Huang, Z. An empirical study on heterogeneous defect prediction approaches. IEEE Trans. Softw. Eng. 2020, 47, 2803–2822. [Google Scholar] [CrossRef]
  34. Liu, X.; Li, Z.; Zou, J.; Tong, H. An Empirical Study on Multi-Source Cross-Project Defect Prediction Models. In Proceedings of the 2022 29th Asia-Pacific Software Engineering Conference (APSEC), Virtual Event, 6–9 December 2022; IEEE: New York, NY, USA; pp. 318–327. [Google Scholar]
  35. Zhang, H.; Zhu, X.; Li, Z.; Xu, B.; Jing, X.Y.; Ying, S. On the Multiple Sources and Privacy Preservation Issues for Heterogeneous Defect Prediction. IEEE Trans. Softw. Eng. 2019, 45, 391–411. [Google Scholar]
  36. Chawla, N.V.; Bowyer, K.W.; Hall, L.O.; Kegelmeyer, W.P. SMOTE: Synthetic minority over-sampling technique. J. Artif. Intell. Res. 2002, 16, 321–357. [Google Scholar] [CrossRef]
  37. Karush, W. Minima of functions of several variables with inequalities as side conditions. In Traces and Emergence of Nonlinear Programming; Springer: Basel, Switzerland, 2013; pp. 217–245. [Google Scholar]
  38. Bhatia, R. Matrix analysis. Grad. Texts Math. 1997, 169, 1–17. [Google Scholar]
  39. Mccabe, T.J. A Complexity Measure. IEEE Trans. Softw. Eng. 2006, 2, 308–320. [Google Scholar] [CrossRef]
  40. Halstead, M.H.; Halstead, M. Elements of Software Science. In Advances in Computers; Elsevier: Amsterdam, The Netherlands, 1977. [Google Scholar]
  41. Chidamber, S.R.; Kemerer, C.F. A Metrics Suite for Object Oriented Design. IEEE Trans. Softw. Eng. 1994, 20, 476–493. [Google Scholar] [CrossRef]
  42. Powers, D.M. Evaluation: From precision, recall and F-measure to ROC, informedness, markedness and correlation. J. Mach. Learn. Technol. 2011, 2, 37–63. [Google Scholar]
  43. Tantithamthavorn, C.; McIntosh, S.; Hassan, A.E.; Matsumoto, K. The impact of automated parameter optimization on defect prediction models. IEEE Trans. Softw. Eng. 2018, 45, 683–711. [Google Scholar] [CrossRef]
  44. Demšar, J. Statistical comparisons of classifiers over multiple data sets. J. Mach. Learn. Res. 2006, 7, 1–30. [Google Scholar]
  45. Cliff, N. Dominance statistics: Ordinal analyses to answer ordinal questions. Psychol. Bull. 1993, 114, 494. [Google Scholar] [CrossRef]
  46. Macbeth, G.; Razumiejczyk, E.; Ledesma, R.D. Cliff’s Delta Calculator: A non-parametric effect size program for two groups of observations. Univ. Psychol. 2011, 10, 545–555. [Google Scholar] [CrossRef]
  47. Yao, J.; Shepperd, M. The impact of using biased performance metrics on software defect prediction research. Inf. Softw. Technol. 2021, 139, 106664. [Google Scholar] [CrossRef]
  48. Yao, J.; Shepperd, M. Assessing software defection prediction performance: Why using the Matthews correlation coefficient matters. In Proceedings of the Evaluation and Assessment in Software Engineering, Trondheim, Norway, 15–17 April 2020; pp. 120–129. [Google Scholar]
  49. Menzies, T.; Greenwald, J.; Frank, A. Data mining static code attributes to learn defect predictors. IEEE Trans. Softw. Eng. 2006, 33, 2–13. [Google Scholar] [CrossRef]
  50. Hall, T.; Beecham, S.; Bowes, D.; Gray, D.; Counsell, S. A systematic literature review on fault prediction performance in software engineering. IEEE Trans. Softw. Eng. 2011, 38, 1276–1304. [Google Scholar] [CrossRef]
Figure 1. Strategy 1 of MSHKM for multi-source HDP.
Figure 1. Strategy 1 of MSHKM for multi-source HDP.
Applsci 13 05526 g001
Figure 2. Strategy 2 of MSHKM for multi-source HDP.
Figure 2. Strategy 2 of MSHKM for multi-source HDP.
Applsci 13 05526 g002
Figure 3. Mapping principle of MSHKM.
Figure 3. Mapping principle of MSHKM.
Applsci 13 05526 g003
Figure 4. Flowchart of MSHKM algorithm.
Figure 4. Flowchart of MSHKM algorithm.
Applsci 13 05526 g004
Figure 5. Tendency of Pd under different n between two strategies in MSHKM.
Figure 5. Tendency of Pd under different n between two strategies in MSHKM.
Applsci 13 05526 g005
Figure 6. Tendency of Pf under different n between two strategies in MSHKM.
Figure 6. Tendency of Pf under different n between two strategies in MSHKM.
Applsci 13 05526 g006
Figure 7. Tendency of GM under different n between two strategies in MSHKM.
Figure 7. Tendency of GM under different n between two strategies in MSHKM.
Applsci 13 05526 g007
Figure 8. Results of different methods, in terms of Pd. Among them, the square represents the mean values and “x” represents outlier values.
Figure 8. Results of different methods, in terms of Pd. Among them, the square represents the mean values and “x” represents outlier values.
Applsci 13 05526 g008
Figure 9. Results of different methods, in terms of Pf. Among them, the square represents the mean values and “x” represents outlier values.
Figure 9. Results of different methods, in terms of Pf. Among them, the square represents the mean values and “x” represents outlier values.
Applsci 13 05526 g009
Figure 10. Results of different methods, in terms of GM. Among them, the square represents the mean values and “x” represents outlier values.
Figure 10. Results of different methods, in terms of GM. Among them, the square represents the mean values and “x” represents outlier values.
Applsci 13 05526 g010
Figure 11. Results of the Nemenyi test for six methods, in terms of Pd.
Figure 11. Results of the Nemenyi test for six methods, in terms of Pd.
Applsci 13 05526 g011
Figure 12. Results of the Nemenyi test for six methods, in terms of Pf.
Figure 12. Results of the Nemenyi test for six methods, in terms of Pf.
Applsci 13 05526 g012
Figure 13. Results of the Nemenyi test for six methods, in terms of GM.
Figure 13. Results of the Nemenyi test for six methods, in terms of GM.
Applsci 13 05526 g013
Table 1. Details of the 28 data sets from five groups.
Table 1. Details of the 28 data sets from five groups.
ProjectData Set# of
Metrics
# of
Modules
# of Buggy Modules (%)
NASACM13732742 (12.84%)
MW13725327 (10.67%)
PC13770561 (8.65%)
PC3371077134 (12.44%)
PC4371458178 12.21%)
SOFTLABAR1291219 (7.44%)
AR329638 (12.70%)
AR42910720 (18.69%)
AR529368 (22.22%)
AR62910115 (14.85%)
RelinkApache2619498 (50.52%)
Safe265622 (39.29%)
ZXing26399118 (29.57%)
AEEEMEQ61324129 (39.81%)
JDT61997206 (20.66%)
LC6169164 (9.26%)
ML611862245 (13.16%)
PDE611497209 (13.96%)
MORPHant1.32012520 (16.00%)
arc2023427 (11.54%)
camel1.02033913 (3.83%)
poi1.520237141 (59.49%)
redaktor2017627 (15.34%)
skarbonka20459 (20.00%)
tomcat2085877 (8.97%)
velocity1.420196147 (75.00%)
Xalan2.420723110 (15.21%)
Xerces1.22044071 (16.14%)
Table 2. Confusion matrix.
Table 2. Confusion matrix.
Actual BuggyActual Clean
Predict Buggy (Positive)TPFP
Predict Clean (Negative)FNTN
Table 3. Evaluation measures.
Table 3. Evaluation measures.
MeasureDefinitionDescriptionBetter
Pd T P T P + F N The proportion of the buggy modules that were correctly predicted as buggyHigh
PF F P F P + T P Probability of false alarm. The proportion of the clean modules that were incorrectly predicted as buggyLow
GM P d × ( 1 P f ) The geometric mean of Pd and 1 − PfHigh
Table 4. Results of MSHKM and baselines for each target, in terms of Pd.
Table 4. Results of MSHKM and baselines for each target, in terms of Pd.
TargetWPDPCCA+HDP-KSCTKCCAMHCPDPMSHKM
CM10.8180.5490.5280.9670.5070.935
MW10.8000.6670.6720.9650.7120.923
PC10.8760.5820.5840.7950.5470.915
PC30.8240.5440.6430.4620.5930.937
PC40.8850.6310.5530.3690.5690.950
AR10.9990.5830.5130.9590.5330.875
AR30.9100.7090.7560.9040.7280.871
AR40.8810.7150.6470.9180.7550.943
AR50.9900.7980.8840.7100.7420.864
AR60.8300.6010.5290.9520.5520.965
Apache0.7210.5110.5140.6620.5270.958
Safe0.8770.6480.5930.8940.6360.935
ZXing0.5390.4600.4230.5610.4540.908
EQ0.7920.5720.4930.5130.5210.940
JDT0.7620.5850.5710.3200.6150.972
LC0.7460.5540.5310.9270.5970.934
ML0.7540.4550.5190.3240.5280.939
PDE0.6130.5700.5700.3150.5330.969
ant1.30.6810.6800.7330.9890.7450.959
arc0.7940.6350.5430.8320.6380.911
camel1.00.5490.6360.6570.9940.6040.931
poi1.50.7870.6230.5440.5330.740 0.927
redaktor0.8130.6650.4780.8090.7360.904
skarbonka0.9970.7300.7640.9770.6850.924
tomcat0.7320.6450.7200.8540.7060.959
Velocity1.40.8970.6600.2710.4960.5880.947
Xalan2.40.7320.5960.5990.5820.5870.934
Xerces1.20.6920.6710.3070.7460.6670.955
Ave.0.7960.6170.5760.7260.619 0.932
Std.0.118 0.078 0.130 0.234 0.088 0.028
Improved17.09%51.05%61.81%28.37%50.57%
A cell with dark gray background    suggests that MSHKM provides a considerable ( 0.474 | δ | ) significant ( p < 0.05 ) improvement over the corresponding method; a medium gray background    indicates that MSHKM provides a moderate ( 0.330 | δ | < 0.474 ) significant improvement; and a light gray background    indicates that MSHKM provides a small ( 0.147 | δ | < 0.330 ) significant improvement.
Table 5. Results of MSHKM and baselines for each target, in terms of Pf.
Table 5. Results of MSHKM and baselines for each target, in terms of Pf.
TargetWPDPCCA+HDP-KSCTKCCAMHCPDPMSHKM
CM10.2530.3010.2670.0880.440 0.037
MW10.1880.3580.3300.1850.322 0.012
PC10.2340.3540.2930.0340.381 0.075
PC30.2560.3080.2970.0010.377 0.029
PC40.1950.2890.2740.0010.329 0.056
AR10.0750.3180.3590.5980.367 0.091
AR30.0650.2490.2970.7350.194 0.084
AR40.1610.2820.2530.5430.279 0.073
AR50.0240.2080.2070.6600.148 0.130
AR60.1360.3590.3190.6610.249 0.235
Apache0.2350.1780.1950.0460.153 0.109
Safe0.0530.1970.2110.6970.203 0.069
ZXing0.2990.2960.2640.0110.372 0.112
EQ0.1640.2670.1860.0010.174 0.050
JDT0.1480.3340.2270.0010.336 0.062
LC0.2150.3360.2810.0080.429 0.062
ML0.2330.2770.2880.0060.253 0.037
PDE0.2680.3460.3020.0010.384 0.035
ant1.30.2180.3950.3240.4680.293 0.051
arc0.2030.3370.2870.3080.332 0.042
camel1.00.3170.3290.3480.1900.332 0.118
poi1.50.2770.4150.2320.0780.180 0.002
redaktor0.1180.4650.3980.3570.232 0.031
skarbonka0.0820.4260.3180.8150.406 0.060
tomcat0.2310.4290.3050.0310.341 0.051
Velocity1.40.1950.4180.5610.0210.449 0.124
Xalan2.40.2250.3790.3170.0050.372 0.015
Xerces1.20.3770.4360.2900.1310.506 0.019
Ave.0.1940.3320.2940.2390.315 0.067
Std.0.085 0.074 0.072 0.283 0.097 0.048
Improved65.46%79.82%77.21%71.97%78.73%
Same description as Table 4.
Table 6. Results of MSHKM and baselines for each target, in terms of GM.
Table 6. Results of MSHKM and baselines for each target, in terms of GM.
TargetWPDPCCA+HDP-KSCTKCCAMHCPDPMSHKM
CM10.7810.6200.6220.9390.5330.949
MW10.8050.6540.6710.8870.6950.955
PC10.8180.6130.6420.8760.5820.920
PC30.7820.6140.6720.6790.6080.954
PC40.8430.6700.6330.6070.6180.947
AR10.9610.6310.5740.6210.5810.892
AR30.9220.7300.7290.4890.7660.893
AR40.8590.7170.6950.6480.7380.935
AR50.9830.7950.8370.4920.7950.867
AR60.8460.6210.6000.5680.6440.859
Apache0.7410.6480.6430.7950.6680.924
Safe0.9100.7210.6840.5210.7120.933
ZXing0.6110.5690.5580.7450.5340.898
EQ0.8130.6470.6340.7160.6560.945
JDT0.8050.6240.6650.5650.6390.955
LC0.7630.6060.6180.9590.5840.936
ML0.7590.5730.6080.5670.6280.951
PDE0.6680.6110.6310.5610.5730.967
ant1.30.7280.6410.7040.7250.7260.954
arc0.7950.6490.6220.7590.6530.934
camel1.00.6100.6540.6550.8980.6350.906
poi1.50.7530.6030.6460.7010.7790.962
redaktor0.8460.5970.5360.7210.7520.936
skarbonka0.9560.6470.7220.4250.6380.932
tomcat0.7490.6060.7070.9100.6820.954
Velocity1.40.8490.6200.3450.6970.5690.911
Xalan2.40.7520.6080.6400.7610.6070.959
Xerces1.20.6540.6150.4660.8050.5740.968
Ave.0.7990.6400.6340.7010.6490.932
Std.0.097 0.050 0.089 0.148 0.074 0.029
Improved16.65%45.63%47%32.95%43.61%
A cell with dark gray background    suggests that MSHKM provides a considerable ( 0.474 | δ | ) significant ( p < 0.05 ) improvement over the corresponding method; a medium gray background    indicates that MSHKM provides a moderate ( 0.330 | δ | < 0.474 ) significant improvement.
Table 7. Counts and medians of the best results in terms of Pd, Pf, and GM, using different methods.
Table 7. Counts and medians of the best results in terms of Pd, Pf, and GM, using different methods.
PdPfGM
MethodCountMedianCountMedianCountMedian
WPDP40.99050.06540.959
CCA+0/0/0/
HDP-KS0/0/0/
CTKCCA40.965130.01010.959
MHCPDP0/0/0/
MSHKM200.940100.079230.946
Table 8. Friedman test results.
Table 8. Friedman test results.
Mean Rank
PdPfGM
WPDP4.536 2.750 4.643
CCA+2.500 4.929 2.429
HDP-KS2.214 4.250 2.393
CTKCCA3.679 2.821 3.179
MHCPDP2.536 4.607 2.571
MSHKM5.571 1.643 5.821
p-values<<0.001<<0.001<<0.001
Table 9. Evaluation standard of Cliff’s delta.
Table 9. Evaluation standard of Cliff’s delta.
Cliff’s Delta (δ)Effectiveness Levels
−1 ≤ δ < 0.147Negligible (N)
0.147 ≤ δ < 0.33 Small (S)
0.33 ≤ δ < 0.474 Medium (M)
0.474 ≤ δ ≤ 1Large (L)
Table 10. The counts of effectiveness levels for MSHKM, with respect to Cliff’s delta test.
Table 10. The counts of effectiveness levels for MSHKM, with respect to Cliff’s delta test.
MeasureLevelAgainst
WPDPCCA+HDP-KSCTKCCAMHCPDP
PdN30060
S00110
M40030
L2128271828
PfN100130
S20000
M30010
L2228281428
GMN40010
S00000
M20120
L2228272528
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

Share and Cite

MDPI and ACS Style

Yao, J.; Liu, B.; Wu, Y.; Li, Z. Multi-Source Heterogeneous Kernel Mapping in Software Defect Prediction. Appl. Sci. 2023, 13, 5526. https://doi.org/10.3390/app13095526

AMA Style

Yao J, Liu B, Wu Y, Li Z. Multi-Source Heterogeneous Kernel Mapping in Software Defect Prediction. Applied Sciences. 2023; 13(9):5526. https://doi.org/10.3390/app13095526

Chicago/Turabian Style

Yao, Jingxiu, Bin Liu, Yumei Wu, and Zhibo Li. 2023. "Multi-Source Heterogeneous Kernel Mapping in Software Defect Prediction" Applied Sciences 13, no. 9: 5526. https://doi.org/10.3390/app13095526

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop