Algorithm 1: MTPL Model Training and Prototype Learning |
|
Require:
Training dataset ;
Number of known classes K;
Loss weights λp, λr;
Batch size B;
Number of training epochs, Ep.
Ensure:
|
1 |
Initialize parameters for the encoder , and classifier . |
2 |
Initialize the learnable prototype matrix using Gaussian random initialization. |
3 |
For epoch = 1 to Ep
do:
|
4 |
for mini-batch from
do: |
5 |
//Forward propagation
|
6 |
Latent features: ; |
7 |
Reconstructed signal: ; |
8 |
Classification logits: ; |
9 |
Classification probabilities: . |
10 |
//Multi-Task Loss Calculation
|
11 |
Classification loss: ; |
12 |
Prototype loss: ; |
13 |
Reconstruction loss: ; |
14 |
Total loss: . |
15 |
//Backward Propagation and Parameter Update
|
16 |
Compute gradients of with respect to all learnable parameters ; |
17 |
Update parameters using an optimizer. |
18 |
end for
|
19 |
End for |
20 |
Return Trained parameters and prototype set
|