This question already has an answer here:
I have a large dataset with rows (100k+) for products and columns for features.
Now I want to create a similarity matrix with
NormalizedSquaredEuclideanDistance. The desired output would be a symmetric matrix with products as columns and rows and the similarity measures as entries.
For[p = 1, p <= Length[dataset[[All,1]]], p++, For[n = 1, n <= Length[dataset[[All,1]]], n++, SimMat[[p, n]] = NormalizedSquaredEuclideanDistance[ dataset[[n, 2 ;; Length[dataset[[n]]]]], dataset[[p, 2 ;; Length[dataset[[p]]]]]]]
There are some problems:
NormalizedSquaredEuclideanDistancedoes not work with how I called the rows.
Using two For-loops for such a big dataset seems not very efficient,