0
$\begingroup$

I am trying to understand the Siamese networks . In this vector is calculated for an object (say an image) and a distance metric is applied (say manhatten) on two vectors produced by the neural network(s). The idea was applied mostly to images in the tutorials provided on internet.

If I compare it with Gensim semantic similarity, there also we have vectors of two objects (words or sentences) and then do a cosine similarity to calculate the difference. (remember example of King-man+woman=Queen).

Am I missing some aspects of Siamese networks or these are actually same?

$\endgroup$
0
$\begingroup$

Siamese and semantic similarity are not same. See example here: Siamese are effectively used for image classifications , but there is a paper publication by Cornell university for text classification as well. Now for your question, we train siamese in a way such that one is positive and one is negative. Lets talk about job title called java developer , we train it with java developer as input and j2ee developer as output in one network. In another network we train java developer as input and QA engineer as output but we dont change weights of the network.

Since we train a neural network with positive and negative so that siamese networks learns the positives and hence its also called one shot learning etc..

Now coming back to semantic similarity- its a unsupervised learning wherein the network will place similar objects together, the cosine distance that we get from gensim is how close one object to the other.

$\endgroup$
1
  • $\begingroup$ 1. This is my main question. In this example (kaggle.com/arpandhatt/siamese-neural-networks), the last dense network is trained on new images and passed through sigmoid to get 0 or 1. Rather than that if these 2 vectors difference is taken directly will that not work? (i.e, L1_layer = Lambda(lambda tensor:K.abs(tensor[0] - tensor[1])) .. can this not be used raw rahter than feeding to dense layer) 2. instead of taking 2 networks, can we take just 1 network and pass the 2 inputs one by one? And then calculate the difference? $\endgroup$ – Sandeep Bhutani Oct 24 '19 at 14:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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