Yashraj Jain
Yashraj Jain

Reputation: 98

'NearMiss' object has no attribute '_validate_data'

Detailed Image

This is the code below which shows the error.

from imblearn.under_sampling import NearMiss
nm = NearMiss()
X_res,y_res=nm.fit_sample(X,Y)

Upvotes: 2

Views: 4330

Answers (2)

PixelPusher
PixelPusher

Reputation: 126

You are probably trying to under sample your imbalanced dataset. For this purpose, you can use RandomUnderSampler instead of NearMiss.

Try the following code:

from imblearn.under_sampling import RandomUnderSampler  

under_sampler = RandomUnderSampler()
X_res, y_res = under_sampler.fit_resample(X, y)

Now, your dataset is balanced. You can verify it using y_res.value_counts().

Cheers!

Upvotes: 1

Yashraj Jain
Yashraj Jain

Reputation: 98

Instead of "imblearn" package my conda installed a package named "imbalanced-learn" that's why it does not take the data. But it is strange that the jupyter notebook doesn't tell me that "imblearn" isn't installed.

Upvotes: 0

Related Questions