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

scikit-plot should decorate object instead of add new methods #23

Closed
leiserfg opened this issue Mar 31, 2017 · 3 comments
Closed

scikit-plot should decorate object instead of add new methods #23

leiserfg opened this issue Mar 31, 2017 · 3 comments

Comments

@leiserfg
Copy link

No description provided.

@reiinakano
Copy link
Owner

Hi @leiserfg ! This is an interesting suggestion. Could you expound with an example of what you want to see?

@leiserfg
Copy link
Author

leiserfg commented Mar 31, 2017

that's what i expected

from sklearn.datasets import load_digits as load_data
from sklearn.naive_bayes import GaussianNB

import matplotlib.pyplot as plt
from scikitplot import classifier_factory

X, y = load_data(return_X_y=True)
nb = GaussianNB()

#canvas can be a subplot instead a plot (imagine that you wanna compare classifiers)
plotter = classifier_factory(nb, canvas=plot)      
plotter.plot_roc_curve(X, y, random_state=1)
plt.show()

@reiinakano
Copy link
Owner

reiinakano commented Apr 19, 2017

Hi @leiserfg , sorry for the long time it took to answer this.

Anyway, all scikit-plot functions have an ax parameter that provides this functionality.

In the case of having a particular subplot to use as a canvas, you would do this.

from sklearn.datasets import load_digits as load_data
from sklearn.naive_bayes import GaussianNB

import matplotlib.pyplot as plt
from scikitplot import classifier_factory

X, y = load_data(return_X_y=True)
nb = GaussianNB()

#canvas can be a subplot instead a plot (imagine that you wanna compare classifiers)
plotter = classifier_factory(nb)      
plotter.plot_roc_curve(X, y, random_state=1, ax=plot)
plt.show()

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

No branches or pull requests

2 participants