String Diagrams with Factorized Densities