We use the K-means clustering algorithm to group z's using a pre-trained embedding corpus (Song et al., 2018).
then we revise the posterior network to perform a two-stage cluster sampling by decomposing q(z|y, x) as : we first compute q(c kz |y, x), which is the probability of the cluster that z belongs to conditioned on both x and y.