{"action":"created","issue":{"url":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/9192","repository_url":"https://api.github.com/repos/scikit-learn/scikit-learn","labels_url":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/9192/labels{/name}","comments_url":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/9192/comments","events_url":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/9192/events","html_url":"https://github.com/scikit-learn/scikit-learn/pull/9192","id":237379734,"number":9192,"title":"[WIP] Try finish #6727: alpha deprecation in LabelPropagation","user":{"login":"jnothman","id":78827,"avatar_url":"https://avatars1.githubusercontent.com/u/78827?v=3","gravatar_id":"","url":"https://api.github.com/users/jnothman","html_url":"https://github.com/jnothman","followers_url":"https://api.github.com/users/jnothman/followers","following_url":"https://api.github.com/users/jnothman/following{/other_user}","gists_url":"https://api.github.com/users/jnothman/gists{/gist_id}","starred_url":"https://api.github.com/users/jnothman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jnothman/subscriptions","organizations_url":"https://api.github.com/users/jnothman/orgs","repos_url":"https://api.github.com/users/jnothman/repos","events_url":"https://api.github.com/users/jnothman/events{/privacy}","received_events_url":"https://api.github.com/users/jnothman/received_events","type":"User","site_admin":false},"labels":[{"id":12995755,"url":"https://api.github.com/repos/scikit-learn/scikit-learn/labels/Bug","name":"Bug","color":"e10c02","default":false},{"id":297514516,"url":"https://api.github.com/repos/scikit-learn/scikit-learn/labels/Needs%20Review","name":"Needs Review","color":"f7c6c7","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/scikit-learn/scikit-learn/milestones/21","html_url":"https://github.com/scikit-learn/scikit-learn/milestone/21","labels_url":"https://api.github.com/repos/scikit-learn/scikit-learn/milestones/21/labels","id":1970916,"number":21,"title":"0.19","description":"","creator":{"login":"amueller","id":449558,"avatar_url":"https://avatars0.githubusercontent.com/u/449558?v=3","gravatar_id":"","url":"https://api.github.com/users/amueller","html_url":"https://github.com/amueller","followers_url":"https://api.github.com/users/amueller/followers","following_url":"https://api.github.com/users/amueller/following{/other_user}","gists_url":"https://api.github.com/users/amueller/gists{/gist_id}","starred_url":"https://api.github.com/users/amueller/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/amueller/subscriptions","organizations_url":"https://api.github.com/users/amueller/orgs","repos_url":"https://api.github.com/users/amueller/repos","events_url":"https://api.github.com/users/amueller/events{/privacy}","received_events_url":"https://api.github.com/users/amueller/received_events","type":"User","site_admin":false},"open_issues":71,"closed_issues":132,"state":"open","created_at":"2016-08-29T22:34:33Z","updated_at":"2017-06-24T07:18:04Z","due_on":"2017-07-04T07:00:00Z","closed_at":null},"comments":26,"created_at":"2017-06-21T00:11:09Z","updated_at":"2017-06-25T13:28:48Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/9192","html_url":"https://github.com/scikit-learn/scikit-learn/pull/9192","diff_url":"https://github.com/scikit-learn/scikit-learn/pull/9192.diff","patch_url":"https://github.com/scikit-learn/scikit-learn/pull/9192.patch"},"body":"Closes  #3550, #5774, #3758, #6727.\r\n\r\nTravis likes it."},"comment":{"url":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/comments/310902667","html_url":"https://github.com/scikit-learn/scikit-learn/pull/9192#issuecomment-310902667","issue_url":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/9192","id":310902667,"user":{"login":"jnothman","id":78827,"avatar_url":"https://avatars1.githubusercontent.com/u/78827?v=3","gravatar_id":"","url":"https://api.github.com/users/jnothman","html_url":"https://github.com/jnothman","followers_url":"https://api.github.com/users/jnothman/followers","following_url":"https://api.github.com/users/jnothman/following{/other_user}","gists_url":"https://api.github.com/users/jnothman/gists{/gist_id}","starred_url":"https://api.github.com/users/jnothman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jnothman/subscriptions","organizations_url":"https://api.github.com/users/jnothman/orgs","repos_url":"https://api.github.com/users/jnothman/repos","events_url":"https://api.github.com/users/jnothman/events{/privacy}","received_events_url":"https://api.github.com/users/jnothman/received_events","type":"User","site_admin":false},"created_at":"2017-06-25T13:28:47Z","updated_at":"2017-06-25T13:28:47Z","body":"Thanks for this great investigation, Manoj. I really appreciate being able\nto close a chapter on another dodgy implementation...\n\nOn 25 June 2017 at 23:27, Joel Nothman <joel.nothman@gmail.com> wrote:\n\n> Yes, confusing W for S would make a lot of sense. I didn't read into\n> _build_graph.\n>\n> I would rather implement what they have in their paper. Let's apply alpha\n> to all. But then we also need to have an explicit ValueError in the case\n> that alpha=0, or we need to handle it specially as a limiting case,\n> particularly if LabelPropagation relies on it.\n>\n> So we could say:\n> * alpha > 0: F = alpha * F + (1 - alpha) * Y\n> * alpha = 0: F = {F[i] if i unlabelled else Y[i]}\n>\n> Any harm keeping soft clamping available for LabelPropagation?\n>\n> On 25 June 2017 at 23:09, Utkarsh Upadhyay <notifications@github.com>\n> wrote:\n>\n>> Okay, so I understand why the test was failing: part of it was the\n>> implementation of the algorithm and part of it was misinterpretation of\n>> clf._build_graph() function.\n>>\n>> The test should have looked like the following:\n>>\n>> n_classes = 2\n>> X, y = make_classification(n_classes=n_classes, n_samples=200, random_state=0)\n>> y[::3] = -1\n>> clf = SS.label_propagation.LabelSpreading().fit(X, y)\n>> # adopting notation from Zhou et al:# W = clf._build_graph()# D = np.diag(W.sum(axis=1))# Dinvroot = scipy.linalg.sqrtm(np.linalg.inv(D))# S = np.dot(np.dot(Dinvroot, W), Dinvroot)\n>>\n>> S = clf._build_graph()\n>> Y = np.zeros((len(y), n_classes + 1))\n>> Y[np.arange(len(y)), y] = 1\n>> Y = Y[:, :-1]for alpha in [0.1, 0.3, 0.5, 0.7, 0.9]:\n>>     expected = np.dot(np.linalg.inv(np.eye(len(S)) - alpha * S), Y)\n>>     expected /= expected.sum(axis=1)[:, np.newaxis]\n>>     clf = SS.label_propagation.LabelSpreading(max_iter=10000, alpha=alpha)\n>>     clf.fit(X, y)\n>>     assert_array_almost_equal(expected, clf.label_distributions_, 4)\n>>\n>> That is, the clf._build_graph() function directly returns S instead of\n>> returning W.\n>>\n>> Then, the \"actual\" algorithm talked about in the paper\n>> <http://citeseer.ist.psu.edu/viewdoc/summary?doi=10.1.1.115.3219> is the\n>> following (our modifications are commented out):\n>>\n>>         # clamp_weights = np.ones((n_samples, 1))\n>>         # clamp_weights[~unlabeled, 0] = alpha\n>>\n>>         # TODO TESTING\n>>         clamp_weights = alpha * np.ones((n_samples, 1))\n>>\n>>         # ...\n>>\n>>         if alpha > 0.:\n>>             y_static *= 1 - alpha\n>>         # TODO TESTING\n>>         # y_static[unlabeled] = 0\n>>\n>> I have this version implemented in this branch\n>> <https://github.com/musically-ut/scikit-learn/blob/tmp-semi-supervised/sklearn/semi_supervised/label_propagation.py#L251>\n>> of my local fork; one can check out that branch and verify that the\n>> sanity-check test does succeed in that case.\n>> ------------------------------\n>>\n>> I can *sort of* see that the modifications we have made to the algorithm\n>> make sense. Similar guarantees *probably* can be worked out for this\n>> modified version as well, but I would be far more comfortable just using\n>> the version from the paper or finding a reference rather than use\n>> unpublished versions.\n>>\n>> What do you think?\n>>\n>> —\n>> You are receiving this because you authored the thread.\n>> Reply to this email directly, view it on GitHub\n>> <https://github.com/scikit-learn/scikit-learn/pull/9192#issuecomment-310901757>,\n>> or mute the thread\n>> <https://github.com/notifications/unsubscribe-auth/AAEz63D5y_ZgPPPUr4INZ_G5fe6ort9iks5sHlv1gaJpZM4OATgT>\n>> .\n>>\n>\n>\n"}}
{"actor":{"display_login":"jnothman"}}