Research Article

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

Algorithm 2

Sample selection-based weight setting algorithm.
 Input: source and target , number of candidate samples N;
 Output: the final training dataset
(1) SCandidate =  //array, which is used to store all the candidate training source samples
(2) For each sample of target project :
(3)  Advanced = ;//Array, which is used to store the selected samples in each loop
(4)  For each sample of source project :
(5)   Calculate the Euclidean distance between and based on equation (2);
(6)   Sort source samples according to the above Euclidean distance information;
(7)   Select the Top N source samples with the smallest distance and store them in advanced;
(8)   SCandidate  SCandidate + Advanced;
(9)  End
(10) End
(11) //array, which is used to store sample weight
(12)For each sample of source project :
(13)  Statistic the sample frequency of in SCandidate and update the
(14)End
(15)Use MaxMinNormalization method to normalize ArrayOfWeight;
(16)Set the source sample weight based on ArrayOfWeight to obtain the final