Inexact matching of structural models based on the duality of patterns and classifiers