IEEE Access (Jan 2023)
SimilarNet: Pairwise Similarity Comparator Layer for Versatile Comparison
Abstract
In recent years, deep learning has attracted considerable attention owing to its ability to address complex problems in various fields. One notable problem is metric space learning, which is aimed at learning feature embeddings through the calculation of the metric space similarity of feature vectors in the embedding space by training embedding models. However, research on metric space similarity has been limited, and the existing methods, such as those based on the cosine similarity or concatenate layer, exhibit drawbacks in terms of flexibility and performance. For example, to apply the cosine similarity, the shapes of the two vectors must be identical, and thus, an advanced comparator cannot be used. Moreover, the concatenate layer cannot reflect the positions of the elements in the two vectors, leading to deteriorated performance and learning success rates. To address these limitations, this paper proposes a specialized artificial neural network layer named SimilarNet, designed to compare two feature vectors while considering the positions of their elements to produce an output in a vector format. By leveraging the advantages of the cosine similarity and concatenation layer, SimilarNet can effectively compare two vectors, enabling the construction of trained comparison models using multidimensional activation functions. In addition, SimilarNet can realize 1:1 comparisons of data with different shapes, unlike cosine similarity. The results of experiments conducted on various datasets indicate that models employing SimilarNet outperform those with the concatenate layer in terms of the comparison accuracy by 4.3% to 26.5% and learning success rate by 5% to 75%.
Keywords