[MRG+2] Making Spectral Embedding Deterministic#4249
[MRG+2] Making Spectral Embedding Deterministic#4249Hasil-Sharma wants to merge 1 commit intoscikit-learn:masterfrom
Conversation
|
Thanks for the PR... 3 minor points :
|
There was a problem hiding this comment.
alternatively you could run flake8 to check for such issues :)
|
Thanks for reviewing my PR. |
There was a problem hiding this comment.
This argument is not needed...
|
No no please don't send a new pr... do the following :
It will get updated here... :) |
b5f91f2 to
c413c0e
Compare
|
@ragv : Thanks for assisting me so patiently, I have done all that you had mentioned in one of your comments. Please tell if it looks good and if there is anything else that I should do ? |
|
You seemed to have reset a few commits that was not made for this PR and added it to a single commit "Making spec..." Please do a |
|
after the rebase simply do a force push... |
|
Yes, between the commits I had done I have merged the |
|
yea :) |
|
or wait... |
|
do:
And in general do a |
c413c0e to
2c53c7c
Compare
|
@ragv : Thanks for assisting me, I think PR is now as it is should be ? |
|
LGTM 👍 |
|
Also can you add test for |
|
Thanks :) Yeah, how should I go about about ? Creating a random n-array on my own and saving it's correct answer and later checking if random n-array is same as correct answer or simply checking that sign of largest absolute value in array in positive or some way else ? |
|
How about both ;)
|
There was a problem hiding this comment.
Could you pl. convert this to a comment? ( Related to #4250 )
( also do the same for the test for eigen_sign_flip )
There was a problem hiding this comment.
@ragv : This is what I have done, please tell if it would be enough ?
- Finding the indexes of maximum absolute value in all the vectors.
- Flipping the vector signs by running
_eigen_sign_flip - Finding the indexes of maximum value in all the vectors.
- Asserting that indexes in step 1 and step 3 are same by using
assert_array_equal
There was a problem hiding this comment.
Yes this is sufficient, I guess
|
@Hasil-Sharma once you have addressed the comments please rename the PR title from |
2c53c7c to
37f276a
Compare
Yea sure! :) BTW could I trouble you with |
|
Pray tell me minor fixes I should make :) |
sklearn/utils/tests/test_extmath.py
Outdated
There was a problem hiding this comment.
combine both lines to get
data = np.random.RandomState(36).randn(5, 5)
or if you feel like, could you instead refactor all these out ( since they are repeated across multiple tests ) to the top like
rng = np.random.RandomState(0)
and use rng everywhere inside the tests instead? ( preferably in a separate commit )...
like Ignore this... This could perhaps be done in a separate PR...rng.randn(5, 5) etc...
|
After the above 4 fixes please change from [WIP] to [MRG+1] ! Thanks for working on this! |
f67b00d to
226d905
Compare
|
@ragv : All changes done, and changing [WIP] to [MRG+1] Thanks for guiding me all the way through :) |
sklearn/utils/extmath.py
Outdated
There was a problem hiding this comment.
I would rename this to _deterministic_vector_sign_flip (the _ to keep it a private utility function). This function does not need to work only with eigen vectors of a matrix but any vectors so there is no need to put 'eigen' in the name or docstring.
|
After renaming and removing references to this being eigenvectors, +1 for merge. |
226d905 to
a25e86f
Compare
|
All changes done :) |
a25e86f to
72a6e08
Compare
|
LGTM |
There was a problem hiding this comment.
I will do the changes myself when merging but FYI PEP8 requires 2 blank lines to separate top level blocks and white spaces around binary operators.
|
Merged by rebase, thanks for your contribution @Hasil-Sharma! |
|
Hum, for some reason, adding SpectralEmbedding to the test still fails: |
|
I think this happens since, for the particular input setup, the graph is not fully connected as it warns accordingly... using |
|
but shouldn't it still be deterministic? |
|
I am sorry I do not understand how it works, but from the warning message -
does that mean it can be expected to be non deterministic for input setups which gives a not-fully-connected adj. matrix? |
|
ok but then we should investigate why that is. |
fixes #4236