{"action":"closed","issue":{"url":"https://api.github.com/repos/fmfn/UnbalancedDataset/issues/26","repository_url":"https://api.github.com/repos/fmfn/UnbalancedDataset","labels_url":"https://api.github.com/repos/fmfn/UnbalancedDataset/issues/26/labels{/name}","comments_url":"https://api.github.com/repos/fmfn/UnbalancedDataset/issues/26/comments","events_url":"https://api.github.com/repos/fmfn/UnbalancedDataset/issues/26/events","html_url":"https://github.com/fmfn/UnbalancedDataset/issues/26","id":126364455,"number":26,"title":"index error when fit_transform a large dataset","user":{"login":"eromoe","id":3938751,"avatar_url":"https://avatars.githubusercontent.com/u/3938751?v=3","gravatar_id":"","url":"https://api.github.com/users/eromoe","html_url":"https://github.com/eromoe","followers_url":"https://api.github.com/users/eromoe/followers","following_url":"https://api.github.com/users/eromoe/following{/other_user}","gists_url":"https://api.github.com/users/eromoe/gists{/gist_id}","starred_url":"https://api.github.com/users/eromoe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eromoe/subscriptions","organizations_url":"https://api.github.com/users/eromoe/orgs","repos_url":"https://api.github.com/users/eromoe/repos","events_url":"https://api.github.com/users/eromoe/events{/privacy}","received_events_url":"https://api.github.com/users/eromoe/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-01-13T08:02:40Z","updated_at":"2016-06-26T13:34:35Z","closed_at":"2016-06-26T13:34:35Z","body":"I have `X_train_features.shape` (30962, 15637) and `y_train.shape\r\n` (30962,)\r\n\r\n`type(X_train_features)` is `scipy.sparse.csr.csr_matrix`\r\n\r\nget index error:\r\n\r\n```\r\nIndexError                                Traceback (most recent call last)\r\n<ipython-input-44-fa5e3a9ff626> in <module>()\r\n      5 os = OverSampler(ratio=ratio, verbose=verbose)\r\n      6 \r\n----> 7 osx, osy = os.fit_transform(X_train_features, y_train)\r\n\r\nC:\\Python27\\lib\\site-packages\\unbalanceddataset-0.1-py2.7.egg\\unbalanced_dataset\\unbalanced_dataset.pyc in fit_transform(self, x, y)\r\n    260 \r\n    261         self.fit(x, y)\r\n--> 262         self.out_x, self.out_y = self.resample()\r\n    263 \r\n    264         return self.out_x, self.out_y\r\n\r\nC:\\Python27\\lib\\site-packages\\unbalanceddataset-0.1-py2.7.egg\\unbalanced_dataset\\over_sampling.pyc in resample(self)\r\n     52 \r\n     53         # Start with the majority class\r\n---> 54         overx = self.x[self.y == self.maxc]\r\n     55         overy = self.y[self.y == self.maxc]\r\n     56 \r\n\r\nC:\\Python27\\lib\\site-packages\\scipy\\sparse\\csr.pyc in __getitem__(self, key)\r\n    305             row, col = self._index_to_arrays(row, col)\r\n    306 \r\n--> 307         row = asindices(row)\r\n    308         col = asindices(col)\r\n    309         if row.shape != col.shape:\r\n\r\nC:\\Python27\\lib\\site-packages\\scipy\\sparse\\csr.pyc in asindices(x)\r\n    224                     x = x.astype(idx_dtype)\r\n    225             except:\r\n--> 226                 raise IndexError('invalid index')\r\n    227             else:\r\n    228                 return x\r\n\r\nIndexError: invalid index\r\n```"}}
{"actor":{"display_login":"glemaitre"}}