Issue
Using imblearn
for the imbalanced datasets, the parameters seems to have changed. I am using undersampling.NearMiss
.
Here is the code:
from imblearn import under_sampling
balanced = under_sampling.NearMiss()
X_res, y_res = under_sampling.NearMiss.fit_resample(X, y)
Here is the error which it's throwing
TypeError Traceback (most recent call last)
~\AppData\Local\Temp/ipykernel_14792/1374027827.py in <module>
2
3 balanced = under_sampling.NearMiss()
----> 4 X_res, y_res = under_sampling.NearMiss.fit_resample(X, y)
TypeError: fit_resample() missing 1 required positional argument: 'y'
Solution
You are not using the object you just defined.
This should do the trick:
from imblearn import under_sampling
balanced = under_sampling.NearMiss()
X_res, y_res = balanced.fit_resample(X, y)
Answered By - Antoine Dubuis
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.