{"action":"created","issue":{"url":"https://api.github.com/repos/scikit-multiflow/scikit-multiflow/issues/46","repository_url":"https://api.github.com/repos/scikit-multiflow/scikit-multiflow","labels_url":"https://api.github.com/repos/scikit-multiflow/scikit-multiflow/issues/46/labels{/name}","comments_url":"https://api.github.com/repos/scikit-multiflow/scikit-multiflow/issues/46/comments","events_url":"https://api.github.com/repos/scikit-multiflow/scikit-multiflow/issues/46/events","html_url":"https://github.com/scikit-multiflow/scikit-multiflow/issues/46","id":352140305,"node_id":"MDU6SXNzdWUzNTIxNDAzMDU=","number":46,"title":"HoeffdingTree predict_proba returns different dimensions per sample","user":{"login":"lfleck","id":26580934,"node_id":"MDQ6VXNlcjI2NTgwOTM0","avatar_url":"https://avatars1.githubusercontent.com/u/26580934?v=4","gravatar_id":"","url":"https://api.github.com/users/lfleck","html_url":"https://github.com/lfleck","followers_url":"https://api.github.com/users/lfleck/followers","following_url":"https://api.github.com/users/lfleck/following{/other_user}","gists_url":"https://api.github.com/users/lfleck/gists{/gist_id}","starred_url":"https://api.github.com/users/lfleck/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lfleck/subscriptions","organizations_url":"https://api.github.com/users/lfleck/orgs","repos_url":"https://api.github.com/users/lfleck/repos","events_url":"https://api.github.com/users/lfleck/events{/privacy}","received_events_url":"https://api.github.com/users/lfleck/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2018-08-20T13:40:43Z","updated_at":"2018-08-21T14:05:32Z","closed_at":null,"author_association":"NONE","body":"### Expected behaviour\r\noutput_dim = num_samples x num_classes\r\n\r\n### Actual behaviour\r\noutput is an array of lists with different length\r\n\r\n### Steps to reproduce the behaviour\r\ntest files are attached\r\n[data.zip](https://github.com/scikit-multiflow/scikit-multiflow/files/2302548/data.zip)\r\n```\r\nimport numpy as np\r\nfrom skmultiflow.trees.hoeffding_tree import HoeffdingTree\r\n\r\ndata = np.load(\"test_data.npy\")\r\nlabels = np.load(\"test_labels.npy\")\r\n\r\nmodel = HoeffdingTree()\r\nmodel.partial_fit(data, labels)\r\npred_proba = model.predict_proba(data)\r\n```\r\n`>> [list([1.0]), ... , list([0, 1.0]), ... , list([1.0]) , ...] `\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/scikit-multiflow/scikit-multiflow/issues/comments/414686205","html_url":"https://github.com/scikit-multiflow/scikit-multiflow/issues/46#issuecomment-414686205","issue_url":"https://api.github.com/repos/scikit-multiflow/scikit-multiflow/issues/46","id":414686205,"node_id":"MDEyOklzc3VlQ29tbWVudDQxNDY4NjIwNQ==","user":{"login":"lfleck","id":26580934,"node_id":"MDQ6VXNlcjI2NTgwOTM0","avatar_url":"https://avatars1.githubusercontent.com/u/26580934?v=4","gravatar_id":"","url":"https://api.github.com/users/lfleck","html_url":"https://github.com/lfleck","followers_url":"https://api.github.com/users/lfleck/followers","following_url":"https://api.github.com/users/lfleck/following{/other_user}","gists_url":"https://api.github.com/users/lfleck/gists{/gist_id}","starred_url":"https://api.github.com/users/lfleck/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lfleck/subscriptions","organizations_url":"https://api.github.com/users/lfleck/orgs","repos_url":"https://api.github.com/users/lfleck/repos","events_url":"https://api.github.com/users/lfleck/events{/privacy}","received_events_url":"https://api.github.com/users/lfleck/received_events","type":"User","site_admin":false},"created_at":"2018-08-21T14:05:32Z","updated_at":"2018-08-21T14:05:32Z","author_association":"NONE","body":"Yes that would fix it. Currently, `self.classes` is not defined, \r\nhttps://github.com/scikit-multiflow/scikit-multiflow/blob/3bac7c8274948b9c7f4518994a85f4bb5a5b5e0e/src/skmultiflow/trees/hoeffding_tree.py#L936  \r\nhttps://github.com/scikit-multiflow/scikit-multiflow/blob/3bac7c8274948b9c7f4518994a85f4bb5a5b5e0e/src/skmultiflow/trees/hoeffding_tree.py#L960\r\nbut it could be set in the first call of `partial_fit`\r\n\r\nHowever, I would prefer \r\n```python\r\nif self.classes is not None:\r\n    y_proba = np.zeros(len(self.classes))\r\nelse:\r\n    y_proba = np.zeros(len(votes.keys()))\r\n```\r\nsince a 3-class classification problem could have for example labels in [2, 6, 8]. \r\nWhat do you think @jacobmontiel "}}
{"actor":{"display_login":"lfleck"}}