Closed Mengyuan-Zhao closed 2 years ago
Hi Please note that the Euclidean metric when dealing with unit vectors is proportional to the cosine distance multiplied by a constant factor. Therefore, this process is equivalent. Hope this clarifies your questions.
Hi Please note that the Euclidean metric when dealing with unit vectors is proportional to the cosine distance multiplied by a constant factor. Therefore, this process is equivalent. Hope this clarifies your questions.
Thank you!
Your work is really great!I have a question about anomaly criterion in your code. In your paper, there be :
but in this code, I coud not find anything about this part. The knn_score function is the same as PANDA. So I am confused. Is there a part in the code to calculate the cosine distance?
def knn_score(train_set, test_set, n_neighbours=2): index = faiss.IndexFlatL2(train_set.shape[1]) index.add(train_set) D, _ = index.search(test_set, n_neighbours) return np.sum(D, axis=1)
Hope for your reply. Thanks!