internlm/SWE-Fixer-Train-110K huggingface dataset:
Repository: DistrictDataLabs/yellowbrick

Issue:
Joint Plot Viz has messed up (overlapping labels on) axes
**Describe the bug**

If you look at the x and y axis on http://www.scikit-yb.org/en/latest/api/features/scatter.html#joint-plot-visualization you will see that the labels are overlapping.

**To Reproduce**

Create a joint plot as shown in the docs



**Expected behavior**

Labels on axes should be clear.


**Desktop (please complete the following information):**
 - OS: macOS
 - Python Version 3.6.4
 - Yellowbrick Version 0.8


Joint Plot Viz has messed up (overlapping labels on) axes
**Describe the bug**

If you look at the x and y axis on http://www.scikit-yb.org/en/latest/api/features/scatter.html#joint-plot-visualization you will see that the labels are overlapping.

**To Reproduce**

Create a joint plot as shown in the docs



**Expected behavior**

Labels on axes should be clear.


**Desktop (please complete the following information):**
 - OS: macOS
 - Python Version 3.6.4
 - Yellowbrick Version 0.8




Discussion:

Resolving patch:
diff --git a/docs/api/features/jointplot.py b/docs/api/features/jointplot.py
--- a/docs/api/features/jointplot.py
+++ b/docs/api/features/jointplot.py
@@ -5,12 +5,8 @@
 
 
 def jointplot(X, y, outpath, **kwargs):
-    # Create a new figure and axes
-    fig = plt.figure()
-    ax = fig.add_subplot(111)
-
     # Create the visualizer
-    visualizer = JointPlotVisualizer(ax=ax, **kwargs)
+    visualizer = JointPlotVisualizer(**kwargs)
     visualizer.fit(X, y)
     visualizer.transform(X)
 


Test patch:
Repository: DistrictDataLabs/yellowbrick

Issue:
Visualizer does not forget previous plot.
**Describe the bug**
When making consecutive plots in python script, the older plots are still visible.

**To Reproduce**
In `doc/api/target/`,
```python
python class_balance.py
```

**Expected behavior**
![class_balance_compare](https://user-images.githubusercontent.com/8103276/44442443-1964bb00-a587-11e8-8297-54902dbc9277.png)
![class_balance](https://user-images.githubusercontent.com/8103276/44442446-1c5fab80-a587-11e8-9915-73d827e65100.png)

**Traceback**
![class_balance_compare](https://user-images.githubusercontent.com/8103276/44442414-ea4e4980-a586-11e8-83d8-c6b53f8a03c1.png)
![class_balance](https://user-images.githubusercontent.com/8103276/44442415-ec180d00-a586-11e8-9607-77beaa81fcb4.png)

The second plot contains the first plot.

This can be solved by adding `plt.gcf().clear()` after `viz.poof()`.

**Desktop (please complete the following information):**
 - OS: macOS & Ubuntu
 - Python Version 3.6
 - Yellowbrick Version dev


Discussion:

Resolving patch:
diff --git a/yellowbrick/base.py b/yellowbrick/base.py
--- a/yellowbrick/base.py
+++ b/yellowbrick/base.py
@@ -181,7 +181,7 @@ def finalize(self, **kwargs):
         """
         return self.ax
 
-    def poof(self, outpath=None, **kwargs):
+    def poof(self, outpath=None, clear_figure=False, **kwargs):
         """
         Poof makes the magic happen and a visualizer appear! You can pass in
         a path to save the figure to disk with various backends, or you can
@@ -191,7 +191,11 @@ def poof(self, outpath=None, **kwargs):
         Parameters
         ----------
         outpath: string, default: None
-            path or None. Save  figure to disk or if None show in window
+            path or None. Save figure to disk or if None show in window
+
+        clear_figure: boolean, default: False
+            When True, this flag clears the figure after saving to file or
+            showing on screen. This is useful when making consecutive plots.
 
         kwargs: dict
             generic keyword arguments.
@@ -212,6 +216,9 @@ def poof(self, outpath=None, **kwargs):
         else:
             plt.show()
 
+        if clear_figure:
+            plt.gcf().clear()
+
     ##////////////////////////////////////////////////////////////////////
     ## Helper Functions
     ##////////////////////////////////////////////////////////////////////
@@ -533,7 +540,7 @@ def score(self,X,y):
 
         return self
 
-    def poof(self, outpath=None, **kwargs):
+    def poof(self, outpath=None, clear_figure=False, **kwargs):
 
         if self.axarr is None: return
 
@@ -552,3 +559,6 @@ def poof(self, outpath=None, **kwargs):
             plt.savefig(outpath, **kwargs)
         else:
             plt.show()
+
+        if clear_figure:
+            plt.gcf().clear()


Test patch:
Repository: DistrictDataLabs/yellowbrick

Issue:
Extend color selection on ResidualsPlot() to histogram
When running ResidualsPlot() visualizer, the `test_color` and `train_color` do not propagate down to the histogram. It would be nice if the histogram on the right reflected the color choices as well.

```visualizer = ResidualsPlot(regr_ols, test_color='#615d6c', train_color='#6F8AB7')
visualizer.fit(X_train, y_train) 
visualizer.score(X_test, y_test) 
visualizer.poof()```

Results in a plot like this:
![image](https://user-images.githubusercontent.com/4780517/45731507-d5b49f80-bb8c-11e8-9362-a874e7ec3f72.png)







Discussion:

Resolving patch:
diff --git a/yellowbrick/regressor/residuals.py b/yellowbrick/regressor/residuals.py
--- a/yellowbrick/regressor/residuals.py
+++ b/yellowbrick/regressor/residuals.py
@@ -543,10 +543,10 @@ def draw(self, y_pred, residuals, train=False, **kwargs):
 
         # Add residuals histogram
         if self.hist in {True, 'frequency'}:
-            self.hax.hist(residuals, bins=50, orientation="horizontal")
+            self.hax.hist(residuals, bins=50, orientation="horizontal", color=color)
         elif self.hist == 'density':
             self.hax.hist(
-                residuals, bins=50, orientation="horizontal", density=True
+                residuals, bins=50, orientation="horizontal", density=True, color=color
             )
 
         # Ensure the current axes is always the main residuals axes


Test patch:
diff --git a/tests/test_text/test_freqdist.py b/tests/test_text/test_freqdist.py
--- a/tests/test_text/test_freqdist.py
+++ b/tests/test_text/test_freqdist.py
@@ -50,4 +50,4 @@ def test_integrated_freqdist(self):
         visualizer.fit(docs)
 
         visualizer.poof()
-        self.assert_images_similar(visualizer)
+        self.assert_images_similar(visualizer, tol=1)
Repository: DistrictDataLabs/yellowbrick

Issue:
Fix second image in KElbowVisualizer documentation
The second image that was added to the `KElbowVisualizer` documentation in PR #635 is not rendering correctly because the `elbow_is_behind.png` file is not generated by the `elbow.py` file, but was added separately.

- [x] Expand `KElbowVisualizer` documentation in `elbow.rst`
- [x] Add example showing how to hide timing and use `calinski_harabaz` scoring metric
- [x] Update `elbow.py` to generate new image for the documentation.





Discussion:

Resolving patch:
diff --git a/docs/api/cluster/elbow.py b/docs/api/cluster/elbow.py
--- a/docs/api/cluster/elbow.py
+++ b/docs/api/cluster/elbow.py
@@ -1,27 +1,55 @@
-# Clustering Evaluation Imports
-from functools import partial
+#!/usr/bin/env python
 
-from sklearn.cluster import MiniBatchKMeans
-from sklearn.datasets import make_blobs as sk_make_blobs
+"""
+Generate images for the elbow plot documentation.
+"""
 
-from yellowbrick.cluster import KElbowVisualizer
+# Import necessary modules
+import matplotlib.pyplot as plt
 
-# Helpers for easy dataset creation
-N_SAMPLES = 1000
-N_FEATURES = 12
-SHUFFLE = True
+from sklearn.cluster import KMeans
+from sklearn.datasets import make_blobs
+from yellowbrick.cluster import KElbowVisualizer
 
-# Make blobs partial
-make_blobs = partial(sk_make_blobs, n_samples=N_SAMPLES, n_features=N_FEATURES, shuffle=SHUFFLE)
 
+def draw_elbow(path="images/elbow.png"):
+    # Generate synthetic dataset with 8 blobs
+    X, y = make_blobs(
+        centers=8, n_features=12, n_samples=1000,
+        shuffle=True, random_state=42
+    )
 
-if __name__ == '__main__':
-    # Make 8 blobs dataset
-    X, y = make_blobs(centers=8)
+    # Create a new figure to draw the clustering visualizer on
+    _, ax = plt.subplots()
 
     # Instantiate the clustering model and visualizer
+    model = KMeans()
+    visualizer = KElbowVisualizer(model, ax=ax, k=(4,12))
+
+    visualizer.fit(X)                # Fit the data to the visualizer
+    visualizer.poof(outpath=path)    # Draw/show/poof the data
+
+
+def draw_calinski_harabaz(path="images/calinski_harabaz.png"):
+    # Generate synthetic dataset with 8 blobs
+    X, y = make_blobs(
+        centers=8, n_features=12, n_samples=1000,
+        shuffle=True, random_state=42
+    )
+
+    # Create a new figure to draw the clustering visualizer on
+    _, ax = plt.subplots()
+
     # Instantiate the clustering model and visualizer
-    visualizer = KElbowVisualizer(MiniBatchKMeans(), k=(4,12))
+    model = KMeans()
+    visualizer = KElbowVisualizer(
+        model, ax=ax, k=(4,12),
+        metric='calinski_harabaz', timings=False
+    )
+    visualizer.fit(X)                # Fit the data to the visualizer
+    visualizer.poof(outpath=path)    # Draw/show/poof the data
 
-    visualizer.fit(X) # Fit the training data to the visualizer
-    visualizer.poof(outpath="images/elbow.png") # Draw/show/poof the data
+
+if __name__ == '__main__':
+    draw_elbow()
+    draw_calinski_harabaz()


Test patch:
Repository: DistrictDataLabs/yellowbrick

Issue:
Critical Vulnerability in np.load with NumPy v1.16 and earlier
There is a critical vulnerability with NumPy v1.16 and earlier that affects the new YB datasets module:

https://www.bleepingcomputer.com/news/security/numpy-is-awaiting-fix-for-critical-remote-code-execution-bug/

This does not affect any Yellowbrick user for version 0.9.1 or earlier and we will not release version 1.0 without a patch for this bug. When NumPy 1.17 is released (if it contains the fix), we will mark our minimum NumPy requirement to that version. 

Currently, in the `develop` branch, we do use `np.load` when [loading a numpy dataset](https://github.com/DistrictDataLabs/yellowbrick/blob/develop/yellowbrick/datasets/base.py#L195), e.g. if Pandas is not available. We should update this to `np.load(allow_pickle=False)` as per the recommendation of the post above. Note that we do [ensure data downloaded from our repository matches an expected signature](https://github.com/DistrictDataLabs/yellowbrick/blob/708274289d66d9265f7ded03e3445bc2bd70f46e/yellowbrick/datasets/download.py#L106), which minimizes but does not eliminate the risk to Yellowbrick users. 

Thanks @theagent for bringing this to our attention!


Discussion:
It turns out that our `load_game` and `load_mushroom` datasets are affected by this change because they contain string data with `dtype=object`, which results in: `ValueError: Object arrays cannot be loaded when allow_pickle=False` when the patch is applied. 

I tested a workaround to this, and that is to save these arrays with `dtype=np.unicode_` -- which does allow save and load with `allow_pickle=False`. 

Having these datasets as strings allows us to give examples with various forms of categorical encoding such as OneHotEncoding; I'm not sure how modifying the dtype will change these examples. @Kautumn06 I may need some help going through our docs to ensure we don't break anything with this change. 

See: https://github.com/DistrictDataLabs/yellowbrick-datasets/issues/5 for more on the datasets end of things.

Resolving patch:
diff --git a/yellowbrick/datasets/base.py b/yellowbrick/datasets/base.py
--- a/yellowbrick/datasets/base.py
+++ b/yellowbrick/datasets/base.py
@@ -187,7 +187,7 @@ def to_numpy(self):
             A numpy array describing the target vector.
         """
         path = find_dataset_path(self.name, ext=".npz", data_home=self.data_home)
-        with np.load(path) as npf:
+        with np.load(path, allow_pickle=False) as npf:
             if "X" not in npf or "y" not in npf:
                 raise DatasetsError((
                     "the downloaded dataset was improperly packaged without numpy arrays "


Test patch:
Repository: DistrictDataLabs/yellowbrick

Issue:
ImportError: cannot import name 'calinski_harabasz_score' with sklearn 0.20.2
**Describe the bug**

After #887 we unintentionally injected an `ImportError` for our current set of dependencies; namely `calinski_harabasz_score` doesn't exist in scikitlearn 0.20. This does not show up in our current CI/test suite because we always install the latest deps. There are two options to fix:

1. Update our `requirements.txt` to a later version of scikit-learn
2. Wrap the import in `try/except`, e.g.

```python
try:
    from sklearn.metrics import calinski_harabasz_score
except ImportError:
    from sklearn.metrics import calinski_harabaz_score
```

**To Reproduce**

```
>>> from yellowbrick.cluster import ElbowVisualizer
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/benjamin/Workspace/git/yellowbrick/yellowbrick/cluster/__init__.py", line 23, in <module>
    from .elbow import *
  File "/Users/benjamin/Workspace/git/yellowbrick/yellowbrick/cluster/elbow.py", line 33, in <module>
    from sklearn.metrics import calinski_harabasz_score
ImportError: cannot import name 'calinski_harabasz_score'
```

**Expected behavior**

If we use the minimum dependencies as set in `requirements.txt` we should not have import errors. 

**Traceback**

From the tests:

```
________________________________ ERROR collecting tests/test_cluster/test_silhouette.py ________________________________
ImportError while importing test module '/Users/benjamin/Workspace/git/yellowbrick/tests/test_cluster/test_silhouette.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
tests/test_cluster/test_silhouette.py:30: in <module>
    from yellowbrick.cluster.silhouette import SilhouetteVisualizer
yellowbrick/cluster/__init__.py:23: in <module>
    from .elbow import *
yellowbrick/cluster/elbow.py:33: in <module>
    from sklearn.metrics import calinski_harabasz_score
E   ImportError: cannot import name 'calinski_harabasz_score'
```

**Desktop (please complete the following information):**
 - OS: macOS
 - Python Version: 3.6.2
 - Yellowbrick Version: develop
- Scikit-Learn Version: 0.20.2 


Discussion:

Resolving patch:
diff --git a/yellowbrick/cluster/elbow.py b/yellowbrick/cluster/elbow.py
--- a/yellowbrick/cluster/elbow.py
+++ b/yellowbrick/cluster/elbow.py
@@ -30,10 +30,14 @@
 from ..utils import KneeLocator
 
 from sklearn.metrics import silhouette_score
-from sklearn.metrics import calinski_harabasz_score
 from sklearn.metrics.pairwise import pairwise_distances
 from sklearn.preprocessing import LabelEncoder
 
+try:
+    from sklearn.metrics import calinski_harabasz_score as chs
+except ImportError:
+    from sklearn.metrics import calinski_harabaz_score as chs
+
 
 ## Packages for export
 __all__ = [
@@ -114,7 +118,7 @@ def distortion_score(X, labels, metric='euclidean'):
 KELBOW_SCOREMAP = {
     "distortion": distortion_score,
     "silhouette": silhouette_score,
-    "calinski_harabasz": calinski_harabasz_score,
+    "calinski_harabasz": chs,
 }
 
 


Test patch:
Repository: DistrictDataLabs/yellowbrick

Issue:
Installs tests package
**Describe the bug**
Installing yellowbrick also installs a package "tests" into the enviornment.

**To Reproduce**
```shell
PS> virtualenv env
PS> .\env\Scripts\activate
PS> python -c "import tests; print(tests.__path__)"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'tests'
PS> pip install yellowbrick
PS> python -c "import tests; print(tests.__path__)"
_NamespacePath(['<PATH_FROM_C:>\\env\\lib\\site-packages\\tests'])
```
I dug into the files and found the scikit-yb developer copyright notice in the source files in the fields.

**Expected behavior**
I would guess it is not the expected nor intendent behavior to install the tests package. Also looking at the setup.py it seems like it should be excluded, so i do not understand why this isn't the case. Mainly,  this is a issue as it causes python to import the yb tests package instead of my local tests package when running pytest.

**Desktop (please complete the following information):**
 - OS: Windows
 - Python Version 3.7.4
 - Yellowbrick Version 1.0.1



Discussion:

Resolving patch:
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -77,14 +77,14 @@
 
 ## Directories to ignore in find_packages
 EXCLUDES = (
-    "tests",
+    "tests", "tests.*",
     "bin",
-    "docs",
+    "docs", "docs.*",
     "fixtures",
     "register",
-    "notebooks",
-    "examples",
-    "binder",
+    "notebooks", "notebooks.*",
+    "examples", "examples.*",
+    "binder", "binder.*",
     "paper",
 )
 


Test patch:
Repository: DistrictDataLabs/yellowbrick

Issue:
KelbowVisualizer: The letters in the Legend Label are smushed together (missing spacing)
**Describe the issue**
A clear and concise description of what the bug is.
In the Kelbow visualizer I found that the Spacing between letters in the legend are absent. I also found this to be the case in the example visualization for Kelbow in both the latest and develop version of the docs.  See image below
**To Reproduce**

```python
from sklearn.datasets import make_blobs
from sklearn.preprocessing import StandardScaler
from sklearn.cluster import KMeans

from yellowbrick.cluster import KElbowVisualizer

# Generate sample data
centers = [[1, 1], [-1, -1], [1, -1]]
X, labels_true = make_blobs(n_samples=1500, centers=centers, cluster_std=0.3,
                            random_state=0)

Z = StandardScaler().fit_transform(X)
viz = KElbowVisualizer(KMeans())

viz.fit(Z)
viz.show()
```

**Dataset**
Did you use a specific dataset to produce the bug? Where can we access it?
yes... generated in the above code 

**Expected behavior**
A clear and concise description of what you expected to happen.
I expect to see "elbow at k = 3, score = 264.727"

**Desktop (please complete the following information):**
 - OS: [e.g. macOS] MacOS
 - Python Version [e.g. 2.7, 3.6, miniconda] 3.7
 - Yellowbrick Version [e.g. 0.7] 1.1

**Additional context**
Add any other context about the problem here.
![image](https://user-images.githubusercontent.com/1000117/79055299-fe423580-7c19-11ea-966b-52db9516eb60.png)


<!-- If you have a question, note that you can email us via our listserve:
     https://groups.google.com/forum/#!forum/yellowbrick -->

<!-- This line alerts the Yellowbrick maintainers, feel free to use this
     @ address to alert us directly in follow up comments -->
@DistrictDataLabs/team-oz-maintainers



Discussion:

Resolving patch:
diff --git a/yellowbrick/cluster/elbow.py b/yellowbrick/cluster/elbow.py
--- a/yellowbrick/cluster/elbow.py
+++ b/yellowbrick/cluster/elbow.py
@@ -358,7 +358,7 @@ def draw(self):
         # Plot the silhouette score against k
         self.ax.plot(self.k_values_, self.k_scores_, marker="D")
         if self.locate_elbow is True and self.elbow_value_ is not None:
-            elbow_label = "$elbow at k={}, score={:0.3f}$".format(
+            elbow_label = "elbow at $k={}$, $score={:0.3f}$".format(
                 self.elbow_value_, self.elbow_score_
             )
             self.ax.axvline(
@@ -398,7 +398,7 @@ def finalize(self):
 
         # set the legend if locate_elbow=True
         if self.locate_elbow is True and self.elbow_value_ is not None:
-            self.ax.legend(loc="best", fontsize="medium")
+            self.ax.legend(loc="best", fontsize="medium", frameon=True)
 
         # Set the second y axis labels
         if self.timings:


Test patch:
Repository: DistrictDataLabs/yellowbrick

Issue:
A dangling print statement in the new 1.3 release while plotting LearningCurve & ValidationCurve.
**Describe the bug**
A dangling print statement in the new 1.3 release while plotting LearningCurve & ValidationCurve.

**To Reproduce**
Any snippet like the following
```python
viz = validation_curve(
    DecisionTreeClassifier(), X, y, param_name="max_depth",
    param_range=np.arange(2, 50, 2), cv=10, scoring="f1_macro"
)
```

**Dataset**
any

**Expected behavior**
Should not print these logs

**Traceback**

```
If applicable, add the traceback from the exception.
```

**Desktop (please complete the following information):**
 - macOS
 - python 3.7
 - Yellowbrick Version 1.3

**Additional context**
Add any other context about the problem here.
![image](https://user-images.githubusercontent.com/9113166/107856838-fda99b00-6df8-11eb-9cf6-5c4d26bec768.png)




Discussion:

Resolving patch:
diff --git a/yellowbrick/base.py b/yellowbrick/base.py
--- a/yellowbrick/base.py
+++ b/yellowbrick/base.py
@@ -343,7 +343,6 @@ def get_params(self, deep=True):
         for param in list(params.keys()):
             if param.startswith("estimator__"):
                 params[param[len("estimator__"):]] = params.pop(param)
-        print(params.keys(), "\n\n")
         return params
 
     def set_params(self, **params):


Test patch:
Repository: DistrictDataLabs/yellowbrick

Issue:
pytest-runner is deprecated
pytest-runner is deprecated: https://github.com/pytest-dev/pytest-runner/#deprecation-notice

If I find time, then I can make a PR, but I thought I'd let you know in the meantime.


Discussion:
@jamesmyatt thanks for the note! If you can get a PR together, that would be great! 
@bbengfort happy to pick this one up when CI is fixed. 

Resolving patch:
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -163,9 +163,7 @@ def get_description_type(path=PKG_DESCRIBE):
     "zip_safe": False,
     "entry_points": {"console_scripts": []},
     "install_requires": list(get_requires()),
-    "python_requires": ">=3.4, <4",
-    "setup_requires": ["pytest-runner"],
-    "tests_require": ["pytest"],
+    "python_requires": ">=3.4, <4"
 }
 
 


Test patch:
Repository: DistrictDataLabs/yellowbrick

Issue:
ax param ignored in feature_correlation quick method
**Describe the bug**
When using matplotlib subplots create 2 plots of feature correlations side by side, the ax parameter seems to be ignored  and two images are created.

![image1](https://user-images.githubusercontent.com/3305726/109315893-cc35c400-7829-11eb-8453-de098ae7f375.png)
![image2](https://user-images.githubusercontent.com/3305726/109315930-d3f56880-7829-11eb-9f3f-75b4977dcac4.png)

**To Reproduce**

```python
import numpy as np
from sklearn import datasets
import matplotlib.pyplot as plt
from yellowbrick.target.feature_correlation import feature_correlation

#Load the diabetes dataset
data = datasets.load_iris()
X, y = data['data'], data['target']

features = np.array(data['feature_names'])

_, axes = plt.subplots(ncols=2, figsize=(18, 6))

feature_correlation(X, y, labels=features, method='pearson', ax=axes[0])
feature_correlation(X, y, labels=features, method='mutual_info-classification', ax=axes[1])

plt.tight_layout()
```

**Expected behavior**
The expected behaviour would be the plots side by side in a single image.


**Desktop (please complete the following information):**
 - OS: macOS
 - Python Version: Python 3.7.10 (Google Colab)
 - Yellowbrick Version: 1.3.post1

**Additional context**
I can confirm it happens also locally with `Yellowbrick 1.3.post1` running using command line and using jupyter notebooks



Discussion:

Resolving patch:
diff --git a/yellowbrick/target/feature_correlation.py b/yellowbrick/target/feature_correlation.py
--- a/yellowbrick/target/feature_correlation.py
+++ b/yellowbrick/target/feature_correlation.py
@@ -123,7 +123,7 @@ def __init__(
         color=None,
         **kwargs
     ):
-        super(FeatureCorrelation, self).__init__(ax=None, **kwargs)
+        super(FeatureCorrelation, self).__init__(ax, **kwargs)
 
         self.correlation_labels = CORRELATION_LABELS
         self.correlation_methods = CORRELATION_METHODS


Test patch: