Similar Items: Integrating Bayesian network structure into normalizing flows and variational autoencoders