1. A method of examining a structure formed on a semiconductor wafer, the method comprising: obtaining a first diffraction signal measured using a metrology device; obtaining a second diffraction signal generated using a machine learning algorithm, wherein the first and second diffraction signal represent light diffracted from the structure formed on the semiconductor wafer, and wherein the machine learning algorithm receives as a direct input one or more parameters that characterize a profile of the structure to generate the second diffraction signal as a direct output of the machine learning algorithm; comparing the first and second diffraction signals; and when the first and second diffraction signals match within a matching criterion, determining a feature of the structure based on the one or more parameters of the profile used by the machine learning algorithm to generate the second diffraction signal.