reiinakano / scikit-plot

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

Add cross-validation curve for appointed parameter of param_range #80

Open lugq1990 opened 6 years ago

lugq1990 commented 6 years ago

@reiinakano Hi, I have just found that the project of scikit-plot is really helpful for those what to do the data analysis or machine learning, and I use it much. During my working time, I find that for the parameter choosen maybe also be plot for visualization. I have writen a new method for plot the cross-validation for a appointed parameter. I want to create a new branch added the new added method. Is that ok?

reiinakano commented 6 years ago

Hi @lugq1990. Contributions are welcome. Do you mind posting here your proposed plot and some examples?

lugq1990 commented 6 years ago

Because as we use the grid-search like param choosen method, the result is based on the train set only, not on all data, so just like the cross-validation to evaluate the model, so just for those who want to choose param based on the cv, I write a function.The example code as follews. The final result is the plot image. I am wondered if you would see it. from __future__ import absolute_import from sklearn.datasets import load_digits as load_data from sklearn.utils import shuffle import matplotlib.pyplot as plt import scikitplot as skplt from sklearn.svm import SVC X, y = load_data(return_X_y=True) X, y = shuffle(X, y) clf = SVC() param_name = 'C' param_range = [.1,10,100] skplt.estimators.plot_validation_curve(clf, X, y, param_name=param_name, param_range=param_range) plt.show() 2018-02-08_141218