| input: training data, test data | | output: different combinations of performance indicators, including (TP, FN, FP, TN, TPR, FPR, BDR, ACC) and (TP, FN, TPR) | (1) | function PF | (2) | set the number of iterations in the training process, i.e., | (3) | set the number of iterations in the fold-in process, i.e., | (4) | set the number of “topics”, i.e., | (5) | set the number of nearest neighbors for KNN, i.e., | (6) | load the training samples, perform the TF-IDF transformation for training instances | (7) | train the PWFP model | (8) | compute the “topic” probability vectors of training samples, i.e., | (9) | load the test samples, perform the TF-IDF transformation for test instances | (10) | fold-in the test samples | (11) | compute the “topic” probability vectors of test samples, i.e., | (12) | calculate the distance between each training sample and test sample | (13) | perform a KNN classification | (14) | statistic the results | (15) | end function |
|