Building reliable and transparent machine learning systems using structured intermediate representations