I like to do clustering for some input data. My approach is:1) Create some layers which do feature extraction. The output is a N-dimensional vector. Call this network (~these layers) $y_{features} = f(x)$2) Create a new network that works like this: $F(x_1, x_2) = \mathrm{cosineSimilarity}(f(x_1), f(x_2))$, this is the final network. I like to do this with the Merge-layer or Keras, because it seems to be very simple to do that.$F(x1, x2)$ is one big network which just contains two times the subnetwork $f(x)$, of course with the same weights. It will then be trained that it returns 0 for very different inputs and that it returns 1 for similar inputs. Currently i have a dataset with $K$ classes and for every class i have some data records. I would then just train the network with every possible input combinationen (for $x_1\neq x_2$).To only create a positive output-value it is required that $f(x)$ returns vectors that only have positive components (i think sigmoid should work here). In the end the network $f(x)$ may be used to create a vector space for some given data. This vector space may be used for clustering.Does this make sense? Or shouldn't this be done?I saw another approach for such a task:Create the final network $\mathrm{softmax}(f(x))$ (based on the already proposed $f(x)$) and train it with as many classes as possible. Then just take $f(x)$ for the clustering (which means: Just remove the softmax layer).Which approach makes more sense? And why?
Neural Networks: Use cosine-similarity for clustering
neural networks;clustering