A General Approach for Modeling and Inference