# Cross-Project Defect Prediction Method Based on Manifold Feature Transformation
## 3 Cross-Project Defect Prediction Method Based on Manifold Feature Transformation
### Manifold Feature Transformation  
Manifold feature transformation is to transform the original feature space into manifold space and then reduce the data distribution difference between the transformed source project and the transformed target project in the manifold space. The data in the manifold space have the low-dimensional manifold structure of high-dimensional space. Therefore, the data features have good geometric properties, which can avoid the phenomenon of feature distortion [36]. Therefore, we first transformed the features in the original space into the manifold space and then transferred them in the manifold space. In the Grassmann manifold, the feature transformation has an effective numerical form, which can be expressed and solved efficiently [37]. Therefore, this paper transformed the original feature space into the Grassmann manifold space. There are many ways to accomplish this process [38; 39]. We chose the geodesic flow kernel method (i.e., GFK) [40; 41] to complete the manifold feature transformation process because GFK has higher computational efficiency. GFK attempts to model the data domain with \(d\)-dimensional subspaces and then embeds these subspaces into the manifold \(G\). Let \(P_{s}\) and \(P_{T}\) respectively, represent the subspace of the original data space after principal component analysis, then \(G\) can be regarded as a collection of all \(d\)-dimensional subspaces. Each \(d\)-dimensional original subspace can be regarded as a point on \(G\). Therefore, the geodesic \(\{\Phi(t),0\leq t\leq 1\}\) between two points can form a path between the two subspaces. If we make \(P_{S}=\Phi(0),P_{T}=\Phi(1)\), then finding a geodesic from \(\Phi(0)\) to \(\Phi(1)\) is equivalent to transforming the original feature into an infinite-dimensional space, and the integral calculation of this path is the process of migrating the source project to the target project in the manifold space so as to reduce the data distribution difference between the two projects [36]. This method can be considered an incremental migration method from \(\Phi(0)\) to \(\Phi(1)\). Below, we will introduce the construction process and solution process in detail. \(P_{s}\in\mathbb{R}^{D\times d}\) and \(P_{T}\in\mathbb{R}^{D\times d}\) respectively represent the subspace of the source project dataset and the target project dataset after principal component analysis, and \(d\) represents the feature dimension of the subspace, \(R_{s}\in\mathbb{R}^{(D-d)\times d}\) represents the orthogonal complement to \(P_{s}\). Using the canonical Euclidean metric of the Riemannian manifold, the geodesic flow is parameterized [38] as follows:  
\[\Phi(t)\in G(d,D),t\in[0,1]\]  
Additionally, \(P_{s}=\Phi(0),P_{T}=\Phi(1)\), for the other \(t\):  
\[\Phi(t)=P_{s}U_{1}\Gamma(t)-R_{s}U_{2}\Sigma(t)\]  
where \(U_{1}\in\mathbb{R}^{d\times d},U_{2}\in\mathbb{R}^{(D-d)\times d}\) are orthogonal matrices, and they are given by the following SVDs:  
\[P_{s}^{T}P_{T}=U_{1}\Gamma V^{T},R_{s}^{T}P_{T}=-U_{2}\Sigma V^{T}\]  
Figure 1: MFTCPDP method framework. where \(\Gamma\) and \(\Sigma\) are diagonal matrices. The diagonal elements are \(\cos\theta_{i}\) and \(\sin\theta_{i}\), \(i=1\), \(2\), \(\ldots\), \(d\). \(\theta_{i}\) represents the principal angles between \(P_{s}\) and \(P_{T}\). \[0\leq\theta_{1}\leq\theta_{2}\leq\ldots\leq\theta_{d}\leq\pi/2\]  
For the two original feature vectors \(F_{i}\) and \(F_{j}\), we compute their projections into \(\Phi(\mathbf{t})\) for a continuous \(\mathbf{t}\) from \(0\) to \(1\) and concatenate all the projections into infinite-dimensional feature vectors \(Z_{i}^{\infty}\) and \(Z_{j}^{\infty}\).