Skip to main content
. 2021 Apr 24;23(5):522. doi: 10.3390/e23050522
Algorithm 1 THC Algorithm
Require:
       Labeled source dataset XS;
       Unlabeled target dataset XT;
       Epoch t;
       Threshold m;
       Update rate αs,αt.
Ensure:
       Best model M.
  • 1:

    Extract all source features S and target features T;

  • 2:

    Calculate source-class centroids according to Equation (6), store source-class centroids {fi} and target features T in memory;

  • 3:

    fori=0 to t do

  • 4:

        Obtain target features T from memory, calculate Jaccard distance between samples according to Equations (1) and (2);

  • 5:

        Use threshold-based hierarchical clustering to cluster samples according to Equation (3), generate pseudo labels based on clustering results;

  • 6:

        Calculate target-cluster centroids according to Equation (7), store target-cluster centroids {ci} and single-sample clusters {vi} in memory;

  • 7:

        Fine-tune model with contrastive loss and evaluate model performance;

  • 8:

        if mAPi>mAPbest then

  • 9:

             mAPbest=mAPi,

             update best model M;

  • 10:

        end if

  • 11:

        Update target features T, calculate and update source-class centroids {fi}, target-cluster centroids {ci} and single-sample clusters {vi} according to Equations (6)–(9);

  • 12:

    end for