{"action":"created","issue":{"url":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/9772","repository_url":"https://api.github.com/repos/scikit-learn/scikit-learn","labels_url":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/9772/labels{/name}","comments_url":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/9772/comments","events_url":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/9772/events","html_url":"https://github.com/scikit-learn/scikit-learn/issues/9772","id":257863229,"number":9772,"title":"problem with mutual_info_classif when discrete=True","user":{"login":"csalazar94","id":31971555,"avatar_url":"https://avatars1.githubusercontent.com/u/31971555?v=4","gravatar_id":"","url":"https://api.github.com/users/csalazar94","html_url":"https://github.com/csalazar94","followers_url":"https://api.github.com/users/csalazar94/followers","following_url":"https://api.github.com/users/csalazar94/following{/other_user}","gists_url":"https://api.github.com/users/csalazar94/gists{/gist_id}","starred_url":"https://api.github.com/users/csalazar94/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/csalazar94/subscriptions","organizations_url":"https://api.github.com/users/csalazar94/orgs","repos_url":"https://api.github.com/users/csalazar94/repos","events_url":"https://api.github.com/users/csalazar94/events{/privacy}","received_events_url":"https://api.github.com/users/csalazar94/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-09-14T21:32:47Z","updated_at":"2017-09-15T12:10:54Z","closed_at":null,"author_association":"NONE","body":"<!--\r\nIf your issue is a usage question, submit it here instead:\r\n- StackOverflow with the scikit-learn tag: http://stackoverflow.com/questions/tagged/scikit-learn\r\n- Mailing List: https://mail.python.org/mailman/listinfo/scikit-learn\r\nFor more information, see User Questions: http://scikit-learn.org/stable/support.html#user-questions\r\n-->\r\n\r\n<!-- Instructions For Filing a Bug: https://github.com/scikit-learn/scikit-learn/blob/master/CONTRIBUTING.md#filing-bugs -->\r\n\r\n#### Description\r\n<!-- Example: Joblib Error thrown when calling fit on LatentDirichletAllocation with evaluate_every > 0-->\r\n\r\nRuntimeWarning: invalid value encountered in log\r\n  log_outer = -np.log(outer) + log(pi.sum()) + log(pj.sum())\r\n\r\n#### Steps/Code to Reproduce\r\n<!--\r\nExample:\r\n```python\r\nfrom sklearn.feature_extraction.text import CountVectorizer\r\nfrom sklearn.decomposition import LatentDirichletAllocation\r\n\r\ndocs = [\"Help I have a bug\" for i in range(1000)]\r\n\r\nvectorizer = CountVectorizer(input=docs, analyzer='word')\r\nlda_features = vectorizer.fit_transform(docs)\r\n\r\nlda_model = LatentDirichletAllocation(\r\n    n_topics=10,\r\n    learning_method='online',\r\n    evaluate_every=10,\r\n    n_jobs=4,\r\n)\r\nmodel = lda_model.fit(lda_features)\r\n```\r\nIf the code is too long, feel free to put it in a public gist and link\r\nit in the issue: https://gist.github.com\r\n-->\r\n\r\n```\r\nimport pandas as pd\r\nfrom sklearn.feature_selection import mutual_info_classif\r\n\r\na = [1]*(52632+2529) + [2]*(14660+793) + [3]*(3271+204) + [4]*(814+39) + [5]*(316+20)\r\n\r\nb = [0]*52632 + [1]*2529 + [0]*14660 + [1]*793 + [0]*3271 + [1]*204 + [0]*814 + [1]*39 + [0]*316+ [1]*20\r\n\r\ndf = pd.DataFrame([a,b]).T\r\n\r\nmutual_info_classif(df.loc[:,0].values.reshape(-1, 1), df.loc[:,1], discrete_features=True)\r\n```\r\n#### Expected Results\r\n<!-- Example: No error is thrown. Please paste or describe the expected results.-->\r\n\r\narray([ 1.48233078])\r\n\r\n#### Actual Results\r\n<!-- Please paste or specifically describe the actual output or traceback. -->\r\n\r\narray([ nan])\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\nWindows-7-6.1.7601-SP1\r\nPython 3.6.2 |Continuum Analytics, Inc.| (default, Jul 20 2017, 12:30:02) [MSC v.1900 64 bit (AMD64)]\r\nNumPy 1.13.1\r\nSciPy 0.19.1\r\nScikit-Learn 0.19.0\r\n\r\n<!-- Thanks for contributing! -->\r\n"},"comment":{"url":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/comments/329764097","html_url":"https://github.com/scikit-learn/scikit-learn/issues/9772#issuecomment-329764097","issue_url":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/9772","id":329764097,"user":{"login":"lesteve","id":1680079,"avatar_url":"https://avatars1.githubusercontent.com/u/1680079?v=4","gravatar_id":"","url":"https://api.github.com/users/lesteve","html_url":"https://github.com/lesteve","followers_url":"https://api.github.com/users/lesteve/followers","following_url":"https://api.github.com/users/lesteve/following{/other_user}","gists_url":"https://api.github.com/users/lesteve/gists{/gist_id}","starred_url":"https://api.github.com/users/lesteve/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lesteve/subscriptions","organizations_url":"https://api.github.com/users/lesteve/orgs","repos_url":"https://api.github.com/users/lesteve/repos","events_url":"https://api.github.com/users/lesteve/events{/privacy}","received_events_url":"https://api.github.com/users/lesteve/received_events","type":"User","site_admin":false},"created_at":"2017-09-15T12:10:54Z","updated_at":"2017-09-15T12:10:54Z","author_association":"MEMBER","body":"Can not reproduce on an Ubuntu box with similar python, numpy, scipy and scikit-learn versions. The output I get is `array([ 0.00848119])`."}}
{"actor":{"display_login":"lesteve"}}