Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update examples to be v.0.3.0+ compliant #69

Merged
merged 14 commits into from
Oct 21, 2017
Merged

Update examples to be v.0.3.0+ compliant #69

merged 14 commits into from
Oct 21, 2017

Conversation

ljvmiranda921
Copy link
Contributor

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

  • Demos that used the plotters API were removed. Some examples demonstrate by showing how to do it with the factory, and by the plotters API. Since both of them are deprecated, I just removed the other and focused on the updated way to do it.

  • Add a .gitignore file to untrack .ipynb_checkpoints I think they're not needed so I have git ignore them.

  • Explicitly pass a parameter to cmap to avoid matplotlib deprecation warning. This seems a bit weird for me. My environment has matplotlib 2.0.2 and of course scikit-plot 0.3.1. When I call plot_roc_curve or plot_precision_curve, I encounter a deprecation warning on the use of spectral or spectral_r.

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. 😞

ljvmiranda921 added 14 commits October 21, 2017 12:18
This commit adds a .gitignore file to ignore tracking changes in
the .ipynb_checkpoints directory.
This commit updates this example to be compliant on v.0.3.0. Using
the classifier_factory has been removed, and instead plots the
confusion matrix using scikitplot.metrics.plot_confusion_matrix.

In addition, the whole example that uses the plotters module has
also been removed due to deprecation.
This commit updates the plot_elbow curve example where it removes
the need to create a clusterer factory and instead uses the
scikitplot.cluster.plot_elbow_curve method.
This commit updates the use of the plot_feature_importance
method to be compliant with v.0.3.0. The additional example
that uses plotters has been removed for it is deprecated already.
This commit updates the example notebook by using the
scikitplot.metrics.plot_ks_statistic API. This also removes
the plotter example due to depreciation.
This commit defines the colormap explicitly in the plot_precision_recall
example. It turns out that for other matplotlib versions, a warning on
nipy_spectral/nipy_spectral_r is being raised. Defining it avoids this
ugly warning.
This commit updates plot_roc_curve to be compliant with
version 0.3.0. Moreover, the colormap here is defined
explicitly in the function call in order to avoid the ugly
warning raised by nipy_spectral.
@reiinakano
Copy link
Owner

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!

@reiinakano reiinakano merged commit 7d39a7b into reiinakano:master Oct 21, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants