jinhongjung / pyrwr

Python Implementation for Random Walk with Restart (RWR)
MIT License
118 stars 25 forks source link

The shape of the input matrix should be n by n #1

Closed zengyr49 closed 4 years ago

zengyr49 commented 5 years ago

In your code or function : "row_normalize()" as well as other functions, the shape of the function's input matrix should be the same in rows and columns. If the number of rows doesn't match up with that of its columns, we will get error from the function "np.dot()".

If the assumption is that "the matrix.shape[0] == matrix.shape[1]", then why bother to set: m, n = self.A.shape ? It's really redundant and misleading.

I think that the code can be simplified.

jinhongjung commented 4 years ago

Thanks for the comment! I will refactor the codes in this repo overall after this month and reflect your concern into the update.

jinhongjung commented 4 years ago

I've updated the code as your comment!

Please check the updated file at https://github.com/jinhongjung/pyrwr/blob/master/utils/normalizer.py.

Thank for your comment, and I close this issue.