Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is Gaussian kernel being calculated correctly? #22

Open
dylkot opened this issue Mar 27, 2019 · 0 comments
Open

Is Gaussian kernel being calculated correctly? #22

dylkot opened this issue Mar 27, 2019 · 0 comments

Comments

@dylkot
Copy link

dylkot commented Mar 27, 2019

Hi, thank you for implementing this algorithm in Python! Also please forgive me if I am making an obvious mistake here. But I am wondering whether the correction_vectors are being calculated correctly. I am wondering why kdist is being calculated with a dot product rather than with a Euclidean distance

@jit(float32[:, :](float32[:, :], float32[:, :]))
def kdist(m, n):
    dist = np.zeros((m.shape[0], n.shape[0]), dtype=np.float32)
    for i in range(m.shape[0]):
        for j in range(n.shape[0]):
            dist[i, j] = np.dot(m[i], n[j])
    return dist

shouldn't this be

dist[i, j]  =  np.sum((m[i]-n[j])**2)

for exp_distance to be the Gaussian kernel? I get that taking the dot product would be the same as computing the cosine similarity if we assume that m[i] and n[j] have been L1 normalized. But we can be computing correction vectors on ref_batch_out and new_batch_out which aren't necessarily L1 normalized. And I also don't think this is the correct expression for a Gaussian kernel either way.

Thanks for your attention and sorry again if I am making a mistake here. Unfortunately the math of the Gaussian kernel smoothing does not seem to be described in the manuscript.

@dylkot dylkot closed this as completed Mar 27, 2019
@dylkot dylkot reopened this Mar 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant