|
Algorithm 1 THC Algorithm |
| Require: |
|
Labeled source dataset ;
|
|
Unlabeled target dataset ;
|
|
Epoch t;
|
|
Threshold m;
|
|
Update rate ,.
|
| Ensure: |
| Best model M.
|
-
1:
Extract all source features and target features ;
-
2:
Calculate source-class centroids according to Equation (6), store source-class centroids and target features in memory;
-
3:
for to t
do
-
4:
Obtain target features 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 and single-sample clusters in memory;
-
7:
Fine-tune model with contrastive loss and evaluate model performance;
-
8:
if
then
-
9:
,
update best model M;
-
10:
end if
-
11:
Update target features , calculate and update source-class centroids , target-cluster centroids and single-sample clusters according to Equations (6)–(9);
-
12:
end for
|