A SMARTS pattern is used to define a desired template. For each generated molecule, RDKit is used to find the maximum common substructure between the molecule and the template, and the percentage of atoms of the template present in the generated molecule is used as a measure of template match. Drug Likeness. There are different definitions of the drug-likeness property. Here, we use the Quantitative Estimate of Drug-likeness (QED Score) of Bickerton et al. , as implemented in RDKit. This score goes beyond the common Lipinski's Rule of 5 by defining desirability functions for different properties. In the RDKit implementation, eight properties are considered: (i) Molecular weight, (ii) octanol-water partition coefficient, (iii) the number of hydrogen bond donors, (iv) the number of hydrogen bond acceptors, (v) molecular polar surface area, (vi) the number of rotatable bonds, (vii) the number of aromatic rings and (viii) the number of "structural alerts," which searches for 94 functional moieties that are potentially mutagenic, reactive or have unfavorable pharmacokinetic properties. These functions are combined into a unified continuous score that varies from 0.0 (none of the properties is in the favorable range) to 1.0 (all properties are in the favorable range). Synthetic Accessibility. To prevent the generation of too hard-to-synthesize molecules, we also train the generator to comply with the maximum synthetic accessibility score (SAScore), as defined by Ertl and Schuffenhauer 6 and implemented in RDKit. This score is based on a statistical assessment of fragments from over 1 million structures extracted from PubChem and returns a score between 1.0 (easy to synthesize) and 10.0 (very hard to synthesize).