{"action":"created","issue":{"url":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/7969","repository_url":"https://api.github.com/repos/scikit-learn/scikit-learn","labels_url":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/7969/labels{/name}","comments_url":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/7969/comments","events_url":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/7969/events","html_url":"https://github.com/scikit-learn/scikit-learn/issues/7969","id":193210827,"number":7969,"title":"Bug in example code in \"Confusion matrix\" page","user":{"login":"rashchedrin","id":13832473,"avatar_url":"https://avatars.githubusercontent.com/u/13832473?v=3","gravatar_id":"","url":"https://api.github.com/users/rashchedrin","html_url":"https://github.com/rashchedrin","followers_url":"https://api.github.com/users/rashchedrin/followers","following_url":"https://api.github.com/users/rashchedrin/following{/other_user}","gists_url":"https://api.github.com/users/rashchedrin/gists{/gist_id}","starred_url":"https://api.github.com/users/rashchedrin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rashchedrin/subscriptions","organizations_url":"https://api.github.com/users/rashchedrin/orgs","repos_url":"https://api.github.com/users/rashchedrin/repos","events_url":"https://api.github.com/users/rashchedrin/events{/privacy}","received_events_url":"https://api.github.com/users/rashchedrin/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-12-02T20:30:26Z","updated_at":"2016-12-02T23:38:02Z","closed_at":null,"body":"#### Description\r\nAt page \"Confusion matrix\"\r\nhttp://scikit-learn.org/stable/auto_examples/model_selection/plot_confusion_matrix.html\r\nfunction plot_confusion_matrix shows same image for normalization=True and for normalization=False. Numbers differ, but not colors.\r\n(Image of normalized confusion matrix in this page is wrong in the same way: colors of top-left and bottom right corners are different, while both have same value 1.0)\r\n\r\n#### Steps/Code to Reproduce\r\nRun code form example.\r\n\r\n#### Expected Results\r\nPlot different images for normalized and not normalized confusion matrices. \r\n\r\n#### Actual Results\r\nPlots same image but with different numbers.\r\n\r\n\r\n#### How to fix:\r\nMove block\r\n```\r\nif normalize:\r\n        cm = cm.astype('float') / cm.sum(axis=1)[:, np.newaxis]\r\n        print(\"Normalized confusion matrix\")\r\n    else:\r\n        print('Confusion matrix, without normalization')\r\n\r\nprint(cm)\r\n```\r\nbefore \r\n```\r\nplt.imshow(cm, interpolation='nearest', cmap=cmap)\r\n```\r\n\r\n\r\n#### Versions\r\n<!--\r\nPlease run the following snippet and paste the output below.\r\nimport platform; print(platform.platform())\r\nimport sys; print(\"Python\", sys.version)\r\nimport numpy; print(\"NumPy\", numpy.__version__)\r\nimport scipy; print(\"SciPy\", scipy.__version__)\r\nimport sklearn; print(\"Scikit-Learn\", sklearn.__version__)\r\n-->\r\n\r\n\r\n<!-- Thanks for contributing! -->\r\n"},"comment":{"url":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/comments/264591864","html_url":"https://github.com/scikit-learn/scikit-learn/issues/7969#issuecomment-264591864","issue_url":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/7969","id":264591864,"user":{"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},"created_at":"2016-12-02T23:38:02Z","updated_at":"2016-12-02T23:38:02Z","body":"Yeah, you are right. Do you want to submit a pull request to fix it?\r\n\r\nAlternatively, you could also move the plotting function into a new module ``sklearn.plot`` if you feel like it."}}
{"actor":{"display_login":"amueller"}}