-
-
Notifications
You must be signed in to change notification settings - Fork 26k
[FIX] Fixing Issue #3550 - hard clamping. #3758
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
Conversation
Alpha = 1 means hard clamping, right? Can you maybe add that to the docs? They are very rudimentary at the moment :-/ |
Do you think it makes sense to test for other values of alpha? I just looked around but it doesn't seem like the original publication had that parameter. Do you know which paper this is from? |
@@ -420,8 +428,7 @@ def _build_graph(self): | |||
self.nn_fit = None | |||
n_samples = self.X_.shape[0] | |||
affinity_matrix = self._get_kernel(self.X_) | |||
laplacian = graph_laplacian(affinity_matrix, normed=True) | |||
laplacian = -laplacian | |||
laplacian = -graph_laplacian(affinity_matrix, normed=True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would be better to do:
laplacian = graph_laplacian(affinity_matrix, normed=True)
laplacian *= -1
to spare a memory copy.
I am not familiar with how clamping is suppose to work in LabelPropagation and co. Could you please improve the docstring for the parameters (in particular for |
I think we need a reference. This PR basically inverts the meaning of alpha as far as I can tell. I have no way of knowing which one is the correct variant. |
The narrative doc loosely defines the meaning of alpha and indeed it does not seem to be |
Maybe @clayw can give us insights into what alpha should mean and where it is defined in the literature. |
It seems to be defined here: |
I think |
It also looks to me like both algorithms can be implemented in closed form with single SVD (label spreading) or by solving a linear equation (label propagation), and there is no need to iterate. |
So todo:
|
Anyone interested or should I go for it? |
Also, is there a reference for the word LabelSpreading? ^^ |
Catching up here. That is indeed the original book referenced in the docs, and it looks like there's some solution planned out. Testing could be always be more thorough to catch these issues Are there any action items that I could take here? |
Huh, ok I only looked at the papers, not the book (where is it referenced?) Yoshua Bengio, Olivier Delalleau, Nicolas Le Roux. In Semi-Supervised Learning I did not realize that was a reference to a book, I guess it is here: The papers have closed form algorithms. |
Also, the citation should be Bengio, Yoshua, Olivier Delalleau, and Nicolas Le Roux. "Label propagation and quadratic criterion." Semi-supervised learning 10 (2006). Which would make it much much easier to find. I did not realize that was the reference. |
@clayw the book also doesn't mention alpha for Label Propagation, right? |
Alpha that's described in the literature for LabelPropagation in the book (only LabelSpreading), but I don't think it's such a crazy thing to support in this implementation. However, if there's no hard requirement to keep it around, then it can be deprecated. Thanks for fixing the code to catch those cases and sprucing up the docs. Can you run the example at http://scikit-learn.org/stable/auto_examples/semi_supervised/plot_label_propagation_digits.html and verify that there aren't any performance issues with this change? |
Hm, there is actually an alpha in Algorithm 11.2., is that what you were implementing? |
The docs say
Can you point me to where this is explained in the paper? |
@amueller The three TODOs look like ideal tasks for me. I'll open a new issue for the closed form version. We can further discuss there. |
Go for it :) |
Got it. |
@kpysniak, do you plan to finish this PR? |
I think we can assume the answer is "no". Takers? |
Can I take it up ? I am not an expert but will try my best. Thanks. |
I have proposed a solution on #6727 months ago. |
Hi, sorry for missing the link to the PR. Thanks for letting me know. |
Great, @boechat107 sorry we missed it. |
No worries, guys |
Fixed in #9239 |
Fixing issue #3550