{"action":"created","issue":{"url":"https://api.github.com/repos/rasbt/python-machine-learning-book/issues/25","repository_url":"https://api.github.com/repos/rasbt/python-machine-learning-book","labels_url":"https://api.github.com/repos/rasbt/python-machine-learning-book/issues/25/labels{/name}","comments_url":"https://api.github.com/repos/rasbt/python-machine-learning-book/issues/25/comments","events_url":"https://api.github.com/repos/rasbt/python-machine-learning-book/issues/25/events","html_url":"https://github.com/rasbt/python-machine-learning-book/issues/25","id":166921285,"number":25,"title":"Kernal PCA [projecting new data points]","user":{"login":"VedAustin","id":3083310,"avatar_url":"https://avatars.githubusercontent.com/u/3083310?v=3","gravatar_id":"","url":"https://api.github.com/users/VedAustin","html_url":"https://github.com/VedAustin","followers_url":"https://api.github.com/users/VedAustin/followers","following_url":"https://api.github.com/users/VedAustin/following{/other_user}","gists_url":"https://api.github.com/users/VedAustin/gists{/gist_id}","starred_url":"https://api.github.com/users/VedAustin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/VedAustin/subscriptions","organizations_url":"https://api.github.com/users/VedAustin/orgs","repos_url":"https://api.github.com/users/VedAustin/repos","events_url":"https://api.github.com/users/VedAustin/events{/privacy}","received_events_url":"https://api.github.com/users/VedAustin/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/rasbt/python-machine-learning-book/labels/question","name":"question","color":"cc317c"}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2016-07-21T21:24:13Z","updated_at":"2016-07-27T04:45:03Z","closed_at":"2016-07-26T20:40:25Z","body":"So you have this:\r\n```\r\nX, y = make_moons(n_samples=100, random_state=123)\r\nalphas, lambdas =rbf_kernel_pca(X, gamma=15, n_components=1)\r\n```\r\nThen you take a sample from X:\r\n`x_new = X[25]`\r\n\r\nAnd then find the projection for the new sample from:\r\n```\r\nx_reproj = project_x(x_new, X, \r\n...       gamma=15, alphas=alphas, lambdas=lambdas)\r\n```\r\n\r\nBut `x_new` was already a part of alphas and lambdas created using X. In other words, X already had x_new when the rbf_kernel_pca was applied. So should I be surprised that the projected value of x_new coincides exactly in the plots? I would have thought it might have been better to exclude x_new to derive alpha and lambda values and then apply `project_x`. Thoughts?"},"comment":{"url":"https://api.github.com/repos/rasbt/python-machine-learning-book/issues/comments/235482740","html_url":"https://github.com/rasbt/python-machine-learning-book/issues/25#issuecomment-235482740","issue_url":"https://api.github.com/repos/rasbt/python-machine-learning-book/issues/25","id":235482740,"user":{"login":"rasbt","id":5618407,"avatar_url":"https://avatars.githubusercontent.com/u/5618407?v=3","gravatar_id":"","url":"https://api.github.com/users/rasbt","html_url":"https://github.com/rasbt","followers_url":"https://api.github.com/users/rasbt/followers","following_url":"https://api.github.com/users/rasbt/following{/other_user}","gists_url":"https://api.github.com/users/rasbt/gists{/gist_id}","starred_url":"https://api.github.com/users/rasbt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rasbt/subscriptions","organizations_url":"https://api.github.com/users/rasbt/orgs","repos_url":"https://api.github.com/users/rasbt/repos","events_url":"https://api.github.com/users/rasbt/events{/privacy}","received_events_url":"https://api.github.com/users/rasbt/received_events","type":"User","site_admin":false},"created_at":"2016-07-27T04:45:03Z","updated_at":"2016-07-27T04:45:03Z","body":"> Great! Thanks for the reply and lucid explanation. All makes sense - this could be more of an exercise for myself - but could it be possible to create 2 PCA models one with the test point included and one without and then compare the projections? \r\n\r\nYou are very welcome! Yeah, I would only expect a tiny difference if it's only one point -- still an interesting exercise :). \r\n\r\nAnd thanks a lot for the nice words, I am really glad to hear that the book turns out to be so useful to you! It's really nice and motivating to hear that :)"}}
{"actor":{"display_login":"rasbt"}}