fast_knn2spmat question
opened this issue · comments
Hi Lei Yang, thanks for sharing your work~!
May I ask one question? why do we have to make sure the dist is between -eps to 1+eps in the fast_knn2spmat function: here
I didn't encounter any errors when I tried to run the test code, but since we are using cosine similarity, chances are we will get scores like -0.1 in other situations.
thanks!
@yyang2xin Thanks for the question. One concern is that some algorithms may require to use non-negative edge weights, e.g., spectral clustering. A simple trick is to use cosine distance or normalize cosine similarity from [-1, 1] to [0, 1] via s' = (s + 1) / 2
.
However, it is possible that negative edge weights are required in some cases, where negative weights has special meaning and cannot be converted to positive values. We can discuss about this if you post an example.
that's all I need to know, thanks!
hi,I tried to use custom feature for testing gcnv,but I got "AssertionError: min: 1.0, max: 3.4028234663852886e+38" when call fast_knns2spmat(). Generally speaking, this situation would not occur when we use cosine similarity. Can I delete this Assert in my code?
I got the reason!!! I wrote feature with np.float64,but read feature with np.float32.
hi,I tried to use custom feature for testing gcnv,but I got "AssertionError: min: 1.0, max: 3.4028234663852886e+38" when call fast_knns2spmat(). Generally speaking, this situation would not occur when we use cosine similarity. Can I delete this Assert in my code?
I got the reason!!! I wrote feature with np.float64,but read feature with np.float32.
Hello, I have encountered the same problem as you and modified it according to your method, but the problem still exists, can you offer some help?