Research Article

Research on Cross-Company Defect Prediction Method to Improve Software Security

Algorithm 1

Metric clustering algorithm.
  Input: source and target multigranularity metric feature vector and ; number of clusters K;
  Output: source and target representative vector and ;
(1)For each project {Source project S, Target project T}
(2) Randomly select K metrics as the starting centroid of the project ;
(3) Repeat the following process until convergence
(4)  For each metric :
(5)   Calculate the Euclidean distance to each starting centroid based on eq.(2);
(6)  Assign the metric to its nearest cluster with minimum distance;
(7)  End for
(8)  For each cluster :
(9)   Calculate the mean value of the cluster and update its centroid;
(10)  End for
(11) For each cluster :
(12)  Use PCA method to extract the corresponding representative vector ;
(13) End for
(14)End for
(15)Output and ;