Skip to content

[WIP] Issue with ADASYN #100

Closed
Closed
@kansuke231

Description

@kansuke231

Hi all,
I am using ADASYN for over-sampling a dataset with multiple classes. Currently what I do is creating a set of pairs of classes from the dataset, and then run ADASYN one by one. Some pairs of classes are fine, but sometimes I see an error as follows:

File "/Users/myname/env/lib/python2.7/site-packages/imblearn/over_sampling/adasyn.py", line 143, in _sample
    nn_zs = random_state.randint(1, high=self.k + 1, size=num_sample_i)
  File "mtrand.pyx", line 1266, in mtrand.RandomState.randint (numpy/random/mtrand/mtrand.c:14775)
  File "mtrand.pyx", line 1267, in mtrand.RandomState.randint (numpy/random/mtrand/mtrand.c:14599)
  File "mtrand.pyx", line 749, in mtrand._rand_int64 (numpy/random/mtrand/mtrand.c:10123)
ValueError: negative dimensions are not allowed

Seems like the problem is coming from

y[ind_nn[:, 1:]] == self.maj_c_

in the line 148 of adasyn.py, as I print out I see the following:

y[ind_nn[:, 1:]] == self.maj_c_  --->
[[False False False]
 [False False False]
 [False False False]
 [False False False]
 [False False False]
 [False False False]
 [False False False]
 [False False False]
 [False False False]
 [False False False]
 [False False False]
 [False False False]
 [False False False]
 [False False False]
 [False False False]
 [False False False]]

Does anyone have any idea why this is occurring? Thank you!

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions