0

while doing

from imblearn.under_sampling import NearMiss 

I got error

ModuleNotFoundError: No module named 'sklearn.neighbors.base'

After going through the SO thread No module named 'sklearn.neighbors._base' , I changed code to below:

import sklearn.neighbors._base
import sys
sys.modules['sklearn.base'] = sklearn.neighbors._base

Now I got error below

ImportError: cannot import name 'clone' from 'sklearn.neighbors._base' (/home/userr/anaconda3/lib/python3.7/site-packages/sklearn/neighbors/_base.py)

scikit version is 1.0.2

import sklearn
print(sklearn. __version__)
desertnaut
  • 57,590
  • 26
  • 140
  • 166
abd
  • 155
  • 1
  • 9

1 Answers1

0

You need to install the respective package, firstly you need to install the below:-

  1. pip install sklearn (this might change based on your tool or environment and also choose the apt version for your tool and code)

then, import the below 2 statements in your code,

2) import sklearn.neighbors._base

sys.modules['sklearn.neighbors.base'] = sklearn.neighbors._base

hope, this helps you