Similarity-Based Pattern Analysis and Recognition