Research Article

Large-Scale Coarse-to-Fine Object Retrieval Ontology and Deep Local Multitask Learning

Algorithm 5

Finding best thresholds for multilabels.
Procedure: FIND_BEST_THRESHOLDS
Input:
trainPred//an array of multilabel predictions of each sample in the train set
trainLabels//an array of multilabels of all samples in the train set
initThresholds//an array of candidate thresholds with value in [0, 1]
Output:
bestThresholds//an array of best thresholds of each label
Goal:
Find best thresholds for multilabels in an MCC imbalanced data problem solver
BEGIN
for i = 0 to numberOfLabel do:
begin
  [possibleMattVals] ⟵ [NULL]
  #choose threshold
  for j = 0 to length (initThresholds) do:
begin
   [pred] ⟵ [NULL]
   [currTrainLabel] ⟵ [NULL]
   #get prediction from current threshold
   for k = 0 to numberOfSample do:
  begin
    if trainPred [k][i] >= j:
     pred ⟵ 1
    else:
     pred ⟵ 0
    currTrainLabeltrainLabel [k][i]
  end
possibleMattVals ⟵ matthrews_corrcoef (currTrainLabel, pred)   #visit Equation (7) for full computation of MCC.
end
bestThresholdsinitThresholds [position of max(possibleMattVals)]   #the threshold with highest MCC value in the initialized threshold list for each attribute is chosen.
end
END