SMILE: Structural Modeling, Inference, and Learning Engine