'ImportError: cannot import name 'DecisionBoundaryDisplay' from 'sklearn.inspection'

I imported sklearn DecisionBoundaryDisplay via the below command in my Google Colab file.

from sklearn.inspection import DecisionBoundaryDisplay

And I'm getting the following error.

ImportError: cannot import name 'DecisionBoundaryDisplay' from 'sklearn.inspection'

I even installed the following packages & also tried by restarting my runtime but still I'm getting the error.

!pip install --upgrade scikit-learn

!pip install scipy

!pip3 install -U scikit-learn scipy matplotlib

How to fix this issue?



Solution 1:[1]

It seems DecisionBoundaryDisplay is a new feature and it is currently in an unstable development version. To use it, you need to install the nightly build.

Solution 2:[2]

what worked for me was installing scikit learn 1.1.0, i had version 1.0.2 before and got the same error you're encountering.

pip install -U scikit-learn --user

Hope it helps.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Danylo Baibak
Solution 2 Thierry el Sayah