I have a training set with $N$ instances $\{I_1,...I_N\}$, where each pair of instances is associated with a similarity score $S(I_x,I_y)\in [0,1]$ indicates if the two instances are similar or not.

I have developed $M$ similarity functions $\{S_1,...,S_M\}$, each of which is based on a different feature vector I extract from the two instances at the pair $S_m(f_m(I_x), f_m(I_y))\in [0,1]$. Note that these similarity functions are probably correlated in some way.

Given these functions and the my training set, I want to learn a unified similarity prediction function $P$ such that $P=\arg\min_P \|P(I_x,I_j)-S(I_x,I_j)\|^2$.

What is the best way to achieve such a $P$?


2 Answers 2


Welcome to the field of metric learning. If you use this as a google search query, you will get lots of material on your problem. Here is a quick idea on how you can do it.

One way is to find coefficients $\alpha_m$ for each of your similarity functions, and combine them into a global similarity: $S(I_x, I_y) = \frac{1}{M} \sum_m \alpha_m S_m(I_x, I_y)$. Given the squared error, this is a linear least squares problem.

One key issue with metric learning is that it the targets scale quadratically with the number of samples. This might be a hindrance for some least squares procedures, and you might have to resort to a stochastic gradient based optimization technique.

  • $\begingroup$ Bayerj, neat explanation. I have the following question: How does this differ from using a multiple kernel learning (MKL)? For instance, one base kernel could be created with each similarity measure ($S_m$) and the final combined kernel could be considered a weighted sum of the base kernels as explained in this survey paper. Precisely, do these 2 approaches, metric learning and MKL do the same stuff? If not, which one suits the problem explained in the question? Is there any general guideline to choose between the two? $\endgroup$ Apr 17, 2015 at 8:33
  • $\begingroup$ You can get around the complexity issue with the help of Active Learning. This problem does not have many parameters, since the similarity scoring functions are already fixed. $\endgroup$
    – Lutz Büch
    Jun 11, 2018 at 12:14

I wrote an answer to a question that is related. Combining multiple similarity measures in hyperspectral images?

I suggest to turn the problem into a classification problem on the pairs of items. After that you can use your favorite classifier on the paris dataset to combine the similarity measures.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.