Abstract Machine learning on trees has been mostly focused as input. Much less research investigated output, which many applications, such molecule optimization for drug discovery, or hint generation intelligent tutoring systems. In this work, we propose a novel autoencoder approach, called recursive tree grammar (RTG-AE), encodes via bottom-up parser and decodes grammar, both learned neural ne...