{"action":"closed","issue":{"url":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/6031","repository_url":"https://api.github.com/repos/scikit-learn/scikit-learn","labels_url":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/6031/labels{/name}","comments_url":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/6031/comments","events_url":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/6031/events","html_url":"https://github.com/scikit-learn/scikit-learn/issues/6031","id":122161355,"number":6031,"title":"Precision errors in LDA.explained_variance_ratio_","user":{"login":"hlin117","id":1865885,"avatar_url":"https://avatars.githubusercontent.com/u/1865885?v=3","gravatar_id":"","url":"https://api.github.com/users/hlin117","html_url":"https://github.com/hlin117","followers_url":"https://api.github.com/users/hlin117/followers","following_url":"https://api.github.com/users/hlin117/following{/other_user}","gists_url":"https://api.github.com/users/hlin117/gists{/gist_id}","starred_url":"https://api.github.com/users/hlin117/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hlin117/subscriptions","organizations_url":"https://api.github.com/users/hlin117/orgs","repos_url":"https://api.github.com/users/hlin117/repos","events_url":"https://api.github.com/users/hlin117/events{/privacy}","received_events_url":"https://api.github.com/users/hlin117/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/scikit-learn/scikit-learn/labels/Bug","name":"Bug","color":"e10c02"},{"url":"https://api.github.com/repos/scikit-learn/scikit-learn/labels/Easy","name":"Easy","color":"02d7e1"},{"url":"https://api.github.com/repos/scikit-learn/scikit-learn/labels/Need%20Contributor","name":"Need Contributor","color":"009800"}],"state":"closed","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/milestones/0.19","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://avatars.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":124,"closed_issues":14,"state":"open","created_at":"2016-08-29T22:34:33Z","updated_at":"2016-10-07T18:09:33Z","due_on":"2016-12-31T00:00:00Z","closed_at":null},"comments":6,"created_at":"2015-12-15T00:04:36Z","updated_at":"2016-10-07T18:09:33Z","closed_at":"2016-10-07T18:09:33Z","body":"This surfaces the discussion in #5216. Here are some precision differences than @JPFrancoia and I are looking at:\r\n\r\n```python\r\nimport numpy as np\r\nfrom sklearn.discriminant_analysis import LinearDiscriminantAnalysis\r\nfrom sklearn.utils.testing import assert_array_almost_equal\r\n\r\nstate = np.random.RandomState(0)\r\nX = state.normal(loc=0, scale=100, size=(40, 20))\r\ny = state.randint(0, 3, size=(40, 1))\r\n\r\n# Train the LDA classifier. Use the eigen solver\r\nlda_eigen = LDA(solver='eigen', n_components=5)\r\nlda_eigen.fit(X, y)\r\n\r\nlda_svd = LDA(n_components=5, solver='svd')\r\nlda_svd.fit(X, y)\r\nassert_array_almost_equal(lda_eigen.explained_variance_ratio_, lda_svd.explained_variance_ratio_)\r\n```\r\n```\r\nAssertionError:\r\nArrays are not almost equal to 6 decimals\r\n\r\n(shapes (20,), (3,) mismatch)\r\n x: array([  6.03795532e-01,   3.96204468e-01,   5.85621882e-16,\r\n         3.18609950e-16,   2.08378911e-16,   1.21510637e-16,\r\n         7.83079028e-17,   7.58612317e-17,   3.89040436e-17,...\r\n y: array([  5.52469269e-01,   4.47530731e-01,   7.08925911e-17])\r\n```\r\n\r\nBesides the fact that `lda_eigen` has the wrong number of components for the `explained_variance_ratio_` (according to the docs, it should have only `n_components=5`), there are numeric differences as well."}}
{"actor":{"display_login":"amueller"}}