1: for i = 1 to epochs do
2: Sample batch of size n from Sl labeled and Su unlabeled data |Sl| = |Su| = n
3: Sample {z1, ..., zm+n} ∈Sg from the prior Pz
4: Generate encode E(Sl), E(Su) and E(Sg)
5: For labeled data (x, y ∈Sl):
6: Compute Ll_C from Eq. 3
7: Update C by descending:
8: