Repository: DistrictDataLabs/yellowbrick

Issue:
Problem with import yellowbrick.model_selection
**Describe the bug**
Problem with importing libraries

**To Reproduce**

```python
# Steps to reproduce the behavior (code snippet):
# Should include imports, dataset loading, and execution
# Add the traceback below
```
from yellowbrick.model_selection import LearningCurve

**Dataset**
Did you use a specific dataset to produce the bug? Where can we access it?

**Expected behavior**
A clear and concise description of what you expected to happen.

**Traceback**

```
If applicable, add the traceback from the exception.
```
<ipython-input-35-82e8f0d75030> in <module>
     10 from sklearn.tree import DecisionTreeClassifier
     11 from sklearn.model_selection import learning_curve
---> 12 from yellowbrick.model_selection import LearningCurve

~\Anaconda3\lib\site-packages\yellowbrick\__init__.py in <module>
     37 from .anscombe import anscombe
     38 from .datasaurus import datasaurus
---> 39 from .classifier import ROCAUC, ClassBalance, ClassificationScoreVisualizer
     40 
     41 # from .classifier import crplot, rocplot

~\Anaconda3\lib\site-packages\yellowbrick\classifier\__init__.py in <module>
     24 from ..base import ScoreVisualizer
     25 from .base import ClassificationScoreVisualizer
---> 26 from .class_prediction_error import ClassPredictionError, class_prediction_error
     27 from .classification_report import ClassificationReport, classification_report
     28 from .confusion_matrix import ConfusionMatrix, confusion_matrix

~\Anaconda3\lib\site-packages\yellowbrick\classifier\class_prediction_error.py in <module>
     22 
     23 from sklearn.utils.multiclass import unique_labels
---> 24 from sklearn.metrics._classification import _check_targets
     25 
     26 from yellowbrick.draw import bar_stack

ModuleNotFoundError: No module named 'sklearn.metrics._classification'
**Desktop (please complete the following information):**
 - OS: [e.g. macOS]
 - Python Version [e.g. 2.7, 3.6, miniconda]
 - Yellowbrick Version [e.g. 0.7]

**Additional context**
Add any other context about the problem here.



Discussion:
Hi @djyerabati - thanks for using Yellowbrick, and I'm sorry you're having trouble with it. Can I ask what version of scikit-learn are you using? 
'0.21.3'
@djyerabati it looks like there was a change with scikit-learn 0.22 that forced us to modify our import paths. Please update to scikit-learn 0.22 or later and that should resolve the problem. You can do either:

```
$ pip install -U scikit-learn>=0.22
```

or

```
$ conda install scikit-learn>=0.22
```

We will also update our dependencies as further protection from this issue in the future.

Resolving patch:
diff --git a/yellowbrick/classifier/class_prediction_error.py b/yellowbrick/classifier/class_prediction_error.py
--- a/yellowbrick/classifier/class_prediction_error.py
+++ b/yellowbrick/classifier/class_prediction_error.py
@@ -21,12 +21,17 @@
 import numpy as np
 
 from sklearn.utils.multiclass import unique_labels
-from sklearn.metrics._classification import _check_targets
 
 from yellowbrick.draw import bar_stack
 from yellowbrick.classifier.base import ClassificationScoreVisualizer
 from yellowbrick.exceptions import ModelError, YellowbrickValueError, NotFitted
 
+try:
+    # See #1124: this allows compatibility for scikit-learn >= 0.20
+    from sklearn.metrics._classification import _check_targets
+except ImportError:
+    from sklearn.metrics.classification import _check_targets
+
 
 ##########################################################################
 ## Class Prediction Error Chart


Test patch: