python - which is the fastest way to find the similarity between rows [on hold]

74
April 28, 2018, at 5:28 PM

I have the matrix U and I want to calculate the matrix W. Which the fastest way to find the similarity?

Here my code:

 u = [[0.13,0.02,-0.01],
        [0.41,0.07,-0.03],
        [0.55,0.09,-0.04],
        [0.68,0.11,-0.05]]
    n=4
    m=6
    W = numpy.zeros(shape=(n,n))
    for k in range(0, n - 1):
        W[k][k]=1
        for i in range(k + 1, n):
            similarity = 0
            for j in range(0, m):
                similarity += abs(u[k][j] - u[i][j])
            W[i][k]=1 - similarity
            W[k][i]=(1 - similarity)
    W[n - 1][n - 1] = 1
READ ALSO
How to get all possible variant of a word using Python or r [on hold]

How to get all possible variant of a word using Python or r [on hold]

I have a word list and I want to find all possible variant of the wordsInput is a csv containing list: Pain Health

104
Unable to click on links cyclically from a webpage

Unable to click on links cyclically from a webpage

I've written a script in python in combination with selenium to click on few links cyclically from a webpageFirst off the scraper is supposed to click on the search button (without changing anything in the search fields) on the landing page to populate...

89