Yes, DLGM! A novel hierarchical model for hazard classification