reiinakano / scikit-plot

An intuitive library to add plotting functionality to scikit-learn objects.
MIT License
2.43k stars 285 forks source link

Update examples to be v.0.3.0+ compliant #69

Closed ljvmiranda921 closed 7 years ago

ljvmiranda921 commented 7 years ago

Hi @reiinakano , here's my PR! 👍

This commit solves Issue #62 and updates Jupyter notebook examples to be compliant with the latest version. Some things to note:

Summary

So whenever I do this:

import matplotlib.pyplot as plt
from sklearn.naive_bayes import GaussianNB
from sklearn.datasets import load_digits as load_data
import scikitplot as skplt

X, y = load_data(return_X_y=True)
nb = GaussianNB()
nb.fit(X,y)
y_probas = nb.predict_proba(X)

skplt.metrics.plot_precision_recall_curve(y, y_probas)
plt.show()

This appears:

 MatplotlibDeprecationWarning: The spectral and spectral_r colormap was deprecated in version 2.0. Use nipy_spectral and nipy_spectral_r instead.
  warnings.warn(message, mplDeprecation, stacklevel=1)

Although I checked the code in the repo and it's actually supplying nipy_spectral. Hmmm, not sure if it's just an environment problem for me. Either way, I solve it by explicitly passing the cmap parameter instead.

I committed a lot (almost per file), I can rebase my commits after your suggestion/revisions/review. Thank you so much! Sorry if this PR took me a long time, thesis happened. 😞

reiinakano commented 7 years ago

Hi @ljvmiranda921! Thanks a lot for this great PR! Nothing's wrong with your environment, there's just no released version with the fix for the deprecated colormap yet.

No need to rebase, Github has an option to squash commits upon merge. So far LGTM!