Skip to main content
. 2021 Nov 14;11(11):453. doi: 10.3390/bios11110453
Algorithm 1 The pseudo-code of the algorithm to convert the cost matrix to multi-label classification cost. C′ denotes the cost matrix specifying the misclassification cost between each pair of categories. Y is the label matrix of the training dataset. c′ contains the derived false positive costs for each category
c= computeFalsePositiveCosts (C,Y)
  1. # Normalize the training set labels Y to Yn

  2. for i = 1 to N do

  3. # Calculate the label number of samples i

  4. L[i]= max(sum(Y[i,1:m]), 1)

  5. # Normalize the training set labels Y

  6. Yn[i, 1:m]=Y[i, 1:m]/L[i]

  7. endfor

  8. # Calculate the misclassification cost of each label on each sample

  9. SC= matrix_multiply (Yn, C)

  10. # Mask out the entries with positive labels

  11. SC=SC(1Y)

  12. # Calculate the mean false positive costs of each label in the training set

  13. for i =1 to m do

  14. c[i] = sum(SC[1:N, i])/sum(1Y[1:N,i])

  15. endfor

  16. Return c