Structured Neural Networks for Density Estimation and Causal Inference