diff --git a/.pytest_cache/v/cache/nodeids b/.pytest_cache/v/cache/nodeids new file mode 100644 index 0000000..f257071 --- /dev/null +++ b/.pytest_cache/v/cache/nodeids @@ -0,0 +1,152 @@ +[ + "scikitplot/tests/test_classifiers.py::TestClassifierFactory::test_instance_validation", + "scikitplot/tests/test_classifiers.py::TestClassifierFactory::test_method_insertion", + "scikitplot/tests/test_classifiers.py::TestPlotLearningCurve::test_ax", + "scikitplot/tests/test_classifiers.py::TestPlotLearningCurve::test_cv", + "scikitplot/tests/test_classifiers.py::TestPlotLearningCurve::test_n_jobs", + "scikitplot/tests/test_classifiers.py::TestPlotLearningCurve::test_string_classes", + "scikitplot/tests/test_classifiers.py::TestPlotLearningCurve::test_train_sizes", + "scikitplot/tests/test_classifiers.py::TestPlotConfusionMatrix::test_array_like", + "scikitplot/tests/test_classifiers.py::TestPlotConfusionMatrix::test_ax", + "scikitplot/tests/test_classifiers.py::TestPlotConfusionMatrix::test_cmap", + "scikitplot/tests/test_classifiers.py::TestPlotConfusionMatrix::test_cv", + "scikitplot/tests/test_classifiers.py::TestPlotConfusionMatrix::test_do_cv", + "scikitplot/tests/test_classifiers.py::TestPlotConfusionMatrix::test_labels", + "scikitplot/tests/test_classifiers.py::TestPlotConfusionMatrix::test_normalize", + "scikitplot/tests/test_classifiers.py::TestPlotConfusionMatrix::test_shuffle", + "scikitplot/tests/test_classifiers.py::TestPlotConfusionMatrix::test_string_classes", + "scikitplot/tests/test_classifiers.py::TestPlotConfusionMatrix::test_true_pred_labels", + "scikitplot/tests/test_classifiers.py::TestPlotROCCurve::test_array_like", + "scikitplot/tests/test_classifiers.py::TestPlotROCCurve::test_ax", + "scikitplot/tests/test_classifiers.py::TestPlotROCCurve::test_cmap", + "scikitplot/tests/test_classifiers.py::TestPlotROCCurve::test_curve_diffs", + "scikitplot/tests/test_classifiers.py::TestPlotROCCurve::test_do_cv", + "scikitplot/tests/test_classifiers.py::TestPlotROCCurve::test_invalid_curve_arg", + "scikitplot/tests/test_classifiers.py::TestPlotROCCurve::test_predict_proba", + "scikitplot/tests/test_classifiers.py::TestPlotROCCurve::test_string_classes", + "scikitplot/tests/test_classifiers.py::TestPlotKSStatistic::test_array_like", + "scikitplot/tests/test_classifiers.py::TestPlotKSStatistic::test_ax", + "scikitplot/tests/test_classifiers.py::TestPlotKSStatistic::test_do_cv", + "scikitplot/tests/test_classifiers.py::TestPlotKSStatistic::test_predict_proba", + "scikitplot/tests/test_classifiers.py::TestPlotKSStatistic::test_string_classes", + "scikitplot/tests/test_classifiers.py::TestPlotKSStatistic::test_two_classes", + "scikitplot/tests/test_classifiers.py::TestPlotPrecisionRecall::test_array_like", + "scikitplot/tests/test_classifiers.py::TestPlotPrecisionRecall::test_ax", + "scikitplot/tests/test_classifiers.py::TestPlotPrecisionRecall::test_cmap", + "scikitplot/tests/test_classifiers.py::TestPlotPrecisionRecall::test_curve_diffs", + "scikitplot/tests/test_classifiers.py::TestPlotPrecisionRecall::test_do_cv", + "scikitplot/tests/test_classifiers.py::TestPlotPrecisionRecall::test_invalid_curve_arg", + "scikitplot/tests/test_classifiers.py::TestPlotPrecisionRecall::test_predict_proba", + "scikitplot/tests/test_classifiers.py::TestPlotPrecisionRecall::test_string_classes", + "scikitplot/tests/test_classifiers.py::TestFeatureImportances::test_ax", + "scikitplot/tests/test_classifiers.py::TestFeatureImportances::test_feature_importances_in_clf", + "scikitplot/tests/test_classifiers.py::TestFeatureImportances::test_feature_names", + "scikitplot/tests/test_classifiers.py::TestFeatureImportances::test_max_num_features", + "scikitplot/tests/test_classifiers.py::TestFeatureImportances::test_order", + "scikitplot/tests/test_classifiers.py::TestFeatureImportances::test_string_classes", + "scikitplot/tests/test_cluster.py::TestPlotElbow::test_ax", + "scikitplot/tests/test_cluster.py::TestPlotElbow::test_cluster_ranges", + "scikitplot/tests/test_cluster.py::TestPlotElbow::test_n_clusters_in_clf", + "scikitplot/tests/test_cluster.py::TestPlotElbow::test_n_jobs", + "scikitplot/tests/test_cluster.py::TestPlotElbow::test_show_cluster_time", + "scikitplot/tests/test_clustering.py::TestClassifierFactory::test_instance_validation", + "scikitplot/tests/test_clustering.py::TestClassifierFactory::test_method_insertion", + "scikitplot/tests/test_clustering.py::TestPlotSilhouette::test_ax", + "scikitplot/tests/test_clustering.py::TestPlotSilhouette::test_cmap", + "scikitplot/tests/test_clustering.py::TestPlotSilhouette::test_copy", + "scikitplot/tests/test_clustering.py::TestPlotElbow::test_ax", + "scikitplot/tests/test_clustering.py::TestPlotElbow::test_cluster_ranges", + "scikitplot/tests/test_clustering.py::TestPlotElbow::test_n_clusters_in_clf", + "scikitplot/tests/test_decomposition.py::TestPlotPCAComponentVariance::test_ax", + "scikitplot/tests/test_decomposition.py::TestPlotPCAComponentVariance::test_fitted", + "scikitplot/tests/test_decomposition.py::TestPlotPCAComponentVariance::test_target_explained_variance", + "scikitplot/tests/test_decomposition.py::TestPlotPCA2DProjection::test_ax", + "scikitplot/tests/test_decomposition.py::TestPlotPCA2DProjection::test_biplot", + "scikitplot/tests/test_decomposition.py::TestPlotPCA2DProjection::test_cmap", + "scikitplot/tests/test_estimators.py::TestFeatureImportances::test_ax", + "scikitplot/tests/test_estimators.py::TestFeatureImportances::test_feature_importances_in_clf", + "scikitplot/tests/test_estimators.py::TestFeatureImportances::test_feature_names", + "scikitplot/tests/test_estimators.py::TestFeatureImportances::test_max_num_features", + "scikitplot/tests/test_estimators.py::TestFeatureImportances::test_order", + "scikitplot/tests/test_estimators.py::TestFeatureImportances::test_string_classes", + "scikitplot/tests/test_estimators.py::TestPlotLearningCurve::test_ax", + "scikitplot/tests/test_estimators.py::TestPlotLearningCurve::test_cv", + "scikitplot/tests/test_estimators.py::TestPlotLearningCurve::test_n_jobs", + "scikitplot/tests/test_estimators.py::TestPlotLearningCurve::test_random_state_and_shuffle", + "scikitplot/tests/test_estimators.py::TestPlotLearningCurve::test_string_classes", + "scikitplot/tests/test_estimators.py::TestPlotLearningCurve::test_train_sizes", + "scikitplot/tests/test_metrics.py::TestPlotConfusionMatrix::test_array_like", + "scikitplot/tests/test_metrics.py::TestPlotConfusionMatrix::test_ax", + "scikitplot/tests/test_metrics.py::TestPlotConfusionMatrix::test_cmap", + "scikitplot/tests/test_metrics.py::TestPlotConfusionMatrix::test_hide_counts", + "scikitplot/tests/test_metrics.py::TestPlotConfusionMatrix::test_labels", + "scikitplot/tests/test_metrics.py::TestPlotConfusionMatrix::test_normalize", + "scikitplot/tests/test_metrics.py::TestPlotConfusionMatrix::test_string_classes", + "scikitplot/tests/test_metrics.py::TestPlotConfusionMatrix::test_true_pred_labels", + "scikitplot/tests/test_metrics.py::TestPlotROCCurve::test_array_like", + "scikitplot/tests/test_metrics.py::TestPlotROCCurve::test_ax", + "scikitplot/tests/test_metrics.py::TestPlotROCCurve::test_cmap", + "scikitplot/tests/test_metrics.py::TestPlotROCCurve::test_curve_diffs", + "scikitplot/tests/test_metrics.py::TestPlotROCCurve::test_invalid_curve_arg", + "scikitplot/tests/test_metrics.py::TestPlotROCCurve::test_string_classes", + "scikitplot/tests/test_metrics.py::TestPlotROC::test_array_like", + "scikitplot/tests/test_metrics.py::TestPlotROC::test_ax", + "scikitplot/tests/test_metrics.py::TestPlotROC::test_classes_to_plot", + "scikitplot/tests/test_metrics.py::TestPlotROC::test_cmap", + "scikitplot/tests/test_metrics.py::TestPlotROC::test_plot_macro", + "scikitplot/tests/test_metrics.py::TestPlotROC::test_plot_micro", + "scikitplot/tests/test_metrics.py::TestPlotROC::test_string_classes", + "scikitplot/tests/test_metrics.py::TestPlotKSStatistic::test_array_like", + "scikitplot/tests/test_metrics.py::TestPlotKSStatistic::test_ax", + "scikitplot/tests/test_metrics.py::TestPlotKSStatistic::test_string_classes", + "scikitplot/tests/test_metrics.py::TestPlotKSStatistic::test_two_classes", + "scikitplot/tests/test_metrics.py::TestPlotPrecisionRecallCurve::test_array_like", + "scikitplot/tests/test_metrics.py::TestPlotPrecisionRecallCurve::test_ax", + "scikitplot/tests/test_metrics.py::TestPlotPrecisionRecallCurve::test_cmap", + "scikitplot/tests/test_metrics.py::TestPlotPrecisionRecallCurve::test_curve_diffs", + "scikitplot/tests/test_metrics.py::TestPlotPrecisionRecallCurve::test_invalid_curve_arg", + "scikitplot/tests/test_metrics.py::TestPlotPrecisionRecallCurve::test_string_classes", + "scikitplot/tests/test_metrics.py::TestPlotPrecisionRecall::test_array_like", + "scikitplot/tests/test_metrics.py::TestPlotPrecisionRecall::test_ax", + "scikitplot/tests/test_metrics.py::TestPlotPrecisionRecall::test_classes_to_plot", + "scikitplot/tests/test_metrics.py::TestPlotPrecisionRecall::test_cmap", + "scikitplot/tests/test_metrics.py::TestPlotPrecisionRecall::test_plot_micro", + "scikitplot/tests/test_metrics.py::TestPlotPrecisionRecall::test_string_classes", + "scikitplot/tests/test_metrics.py::TestPlotSilhouette::test_array_like", + "scikitplot/tests/test_metrics.py::TestPlotSilhouette::test_ax", + "scikitplot/tests/test_metrics.py::TestPlotSilhouette::test_cmap", + "scikitplot/tests/test_metrics.py::TestPlotSilhouette::test_plot_silhouette", + "scikitplot/tests/test_metrics.py::TestPlotSilhouette::test_string_classes", + "scikitplot/tests/test_metrics.py::TestPlotCalibrationCurve::test_array_like", + "scikitplot/tests/test_metrics.py::TestPlotCalibrationCurve::test_ax", + "scikitplot/tests/test_metrics.py::TestPlotCalibrationCurve::test_cmap", + "scikitplot/tests/test_metrics.py::TestPlotCalibrationCurve::test_decision_function", + "scikitplot/tests/test_metrics.py::TestPlotCalibrationCurve::test_invalid_probas_list", + "scikitplot/tests/test_metrics.py::TestPlotCalibrationCurve::test_not_binary", + "scikitplot/tests/test_metrics.py::TestPlotCalibrationCurve::test_plot_calibration", + "scikitplot/tests/test_metrics.py::TestPlotCalibrationCurve::test_string_classes", + "scikitplot/tests/test_metrics.py::TestPlotCalibrationCurve::test_wrong_clf_names", + "scikitplot/tests/test_metrics.py::TestPlotCalibrationCurve::test_wrong_probas_shape", + "scikitplot/tests/test_metrics.py::TestPlotCumulativeGain::test_array_like", + "scikitplot/tests/test_metrics.py::TestPlotCumulativeGain::test_ax", + "scikitplot/tests/test_metrics.py::TestPlotCumulativeGain::test_string_classes", + "scikitplot/tests/test_metrics.py::TestPlotCumulativeGain::test_two_classes", + "scikitplot/tests/test_metrics.py::TestPlotLiftCurve::test_array_like", + "scikitplot/tests/test_metrics.py::TestPlotLiftCurve::test_ax", + "scikitplot/tests/test_metrics.py::TestPlotLiftCurve::test_string_classes", + "scikitplot/tests/test_metrics.py::TestPlotLiftCurve::test_two_classes", + "scikitplot/tests/test_plotters.py::TestPlotPCAComponentVariance::test_ax", + "scikitplot/tests/test_plotters.py::TestPlotPCAComponentVariance::test_fitted", + "scikitplot/tests/test_plotters.py::TestPlotPCAComponentVariance::test_target_explained_variance", + "scikitplot/tests/test_plotters.py::TestPlotPCA2DProjection::test_ax", + "scikitplot/tests/test_plotters.py::TestPlotPCA2DProjection::test_cmap", + "scikitplot/tests/test_plotters.py::TestValidateLabels::test_invalid_duplicate_numerical_labels", + "scikitplot/tests/test_plotters.py::TestValidateLabels::test_invalid_missing_numerical_labels", + "scikitplot/tests/test_plotters.py::TestValidateLabels::test_invalid_one_duplicate", + "scikitplot/tests/test_plotters.py::TestValidateLabels::test_invalid_one_missing", + "scikitplot/tests/test_plotters.py::TestValidateLabels::test_invalid_two_duplicates", + "scikitplot/tests/test_plotters.py::TestValidateLabels::test_invalid_two_missing", + "scikitplot/tests/test_plotters.py::TestValidateLabels::test_numerical_labels", + "scikitplot/tests/test_plotters.py::TestValidateLabels::test_valid_equal", + "scikitplot/tests/test_plotters.py::TestValidateLabels::test_valid_subset" +] \ No newline at end of file diff --git a/scikit_plot.egg-info/PKG-INFO b/scikit_plot.egg-info/PKG-INFO new file mode 100644 index 0000000..73bb4cd --- /dev/null +++ b/scikit_plot.egg-info/PKG-INFO @@ -0,0 +1,153 @@ +Metadata-Version: 2.1 +Name: scikit-plot +Version: 0.3.7 +Summary: An intuitive library to add plotting functionality to scikit-learn objects. +Home-page: https://github.com/reiinakano/scikit-plot +Author: Reiichiro Nakano +Author-email: reiichiro.s.nakano@gmail.com +License: MIT License +Description: # Welcome to Scikit-plot + + [![PyPI version](https://badge.fury.io/py/scikit-plot.svg)](https://badge.fury.io/py/scikit-plot) + [![license](https://img.shields.io/github/license/mashape/apistatus.svg)]() + [![Build Status](https://travis-ci.org/reiinakano/scikit-plot.svg?branch=master)](https://travis-ci.org/reiinakano/scikit-plot) + [![PyPI](https://img.shields.io/pypi/pyversions/scikit-plot.svg)]() + [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.293191.svg)](https://doi.org/10.5281/zenodo.293191) + + ### Single line functions for detailed visualizations + + ### The quickest and easiest way to go from analysis... + + ![roc_curves](docs/_static/readme_collage.jpg) + + ### ...to this. + + Scikit-plot is the result of an unartistic data scientist's dreadful realization that *visualization is one of the most crucial components in the data science process, not just a mere afterthought*. + + Gaining insights is simply a lot easier when you're looking at a colored heatmap of a confusion matrix complete with class labels rather than a single-line dump of numbers enclosed in brackets. Besides, if you ever need to present your results to someone (virtually any time anybody hires you to do data science), you show them visualizations, not a bunch of numbers in Excel. + + That said, there are a number of visualizations that frequently pop up in machine learning. Scikit-plot is a humble attempt to provide aesthetically-challenged programmers (such as myself) the opportunity to generate quick and beautiful graphs and plots with as little boilerplate as possible. + + ## Okay then, prove it. Show us an example. + + Say we use Naive Bayes in multi-class classification and decide we want to visualize the results of a common classification metric, the Area under the Receiver Operating Characteristic curve. Since the ROC is only valid in binary classification, we want to show the respective ROC of each class if it were the positive class. As an added bonus, let's show the micro-averaged and macro-averaged curve in the plot as well. + + Let's use scikit-plot with the sample digits dataset from scikit-learn. + + ```python + # The usual train-test split mumbo-jumbo + from sklearn.datasets import load_digits + from sklearn.model_selection import train_test_split + from sklearn.naive_bayes import GaussianNB + + X, y = load_digits(return_X_y=True) + X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.33) + nb = GaussianNB() + nb.fit(X_train, y_train) + predicted_probas = nb.predict_proba(X_test) + + # The magic happens here + import matplotlib.pyplot as plt + import scikitplot as skplt + skplt.metrics.plot_roc(y_test, predicted_probas) + plt.show() + ``` + ![roc_curves](examples/roc_curves.png) + + Pretty. + + And... That's it. Encaptured in that small example is the entire philosophy of Scikit-plot: **single line functions for detailed visualization**. You simply browse the plots available in the documentation, and call the function with the necessary arguments. Scikit-plot tries to stay out of your way as much as possible. No unnecessary bells and whistles. And when you *do* need the bells and whistles, each function offers a myriad of parameters for customizing various elements in your plots. + + Finally, compare and [view the non-scikit-plot way of plotting the multi-class ROC curve](http://scikit-learn.org/stable/auto_examples/model_selection/plot_roc.html). Which one would you rather do? + + ## Maximum flexibility. Compatibility with non-scikit-learn objects. + + Although Scikit-plot is loosely based around the scikit-learn interface, you don't actually need Scikit-learn objects to use the available functions. As long as you provide the functions what they're asking for, they'll happily draw the plots for you. + + Here's a quick example to generate the precision-recall curves of a Keras classifier on a sample dataset. + + ```python + # Import what's needed for the Functions API + import matplotlib.pyplot as plt + import scikitplot as skplt + + # This is a Keras classifier. We'll generate probabilities on the test set. + keras_clf.fit(X_train, y_train, batch_size=64, nb_epoch=10, verbose=2) + probas = keras_clf.predict_proba(X_test, batch_size=64) + + # Now plot. + skplt.metrics.plot_precision_recall_curve(y_test, probas) + plt.show() + ``` + ![p_r_curves](examples/p_r_curves.png) + + You can see clearly here that `skplt.metrics.plot_precision_recall_curve` needs only the ground truth y-values and the predicted probabilities to generate the plot. This lets you use *anything* you want as the classifier, from Keras NNs to NLTK Naive Bayes to that groundbreaking classifier algorithm you just wrote. + + The possibilities are endless. + + ## Installation + + Installation is simple! First, make sure you have the dependencies [Scikit-learn](http://scikit-learn.org) and [Matplotlib](http://matplotlib.org/) installed. + + Then just run: + ```bash + pip install scikit-plot + ``` + + Or if you want the latest development version, clone this repo and run + ```bash + python setup.py install + ``` + at the root folder. + + If using conda, you can install Scikit-plot by running: + ```bash + conda install -c conda-forge scikit-plot + ``` + + ## Documentation and Examples + + Explore the full features of Scikit-plot. + + You can find detailed documentation [here](http://scikit-plot.readthedocs.io). + + Examples are found in the [examples folder of this repo](examples/). + + ## Contributing to Scikit-plot + + Reporting a bug? Suggesting a feature? Want to add your own plot to the library? Visit our [contributor guidelines](CONTRIBUTING.md). + + ## Citing Scikit-plot + + Are you using Scikit-plot in an academic paper? You should be! Reviewers love eye candy. + + If so, please consider citing Scikit-plot with DOI [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.293191.svg)](https://doi.org/10.5281/zenodo.293191) + + #### APA + + > Reiichiro Nakano. (2018). reiinakano/scikit-plot: 0.3.7 [Data set]. Zenodo. http://doi.org/10.5281/zenodo.293191 + + #### IEEE + + > [1]Reiichiro Nakano, “reiinakano/scikit-plot: 0.3.7”. Zenodo, 19-Feb-2017. + + #### ACM + + > [1]Reiichiro Nakano 2018. reiinakano/scikit-plot: 0.3.7. Zenodo. + + Happy plotting! + +Platform: any +Classifier: Programming Language :: Python +Classifier: Programming Language :: Python :: 2 +Classifier: Programming Language :: Python :: 2.7 +Classifier: Programming Language :: Python :: 3 +Classifier: Programming Language :: Python :: 3.5 +Classifier: Programming Language :: Python :: 3.6 +Classifier: Natural Language :: English +Classifier: Intended Audience :: Developers +Classifier: Intended Audience :: Science/Research +Classifier: License :: OSI Approved :: MIT License +Classifier: Operating System :: OS Independent +Classifier: Topic :: Scientific/Engineering :: Visualization +Provides-Extra: testing diff --git a/scikit_plot.egg-info/SOURCES.txt b/scikit_plot.egg-info/SOURCES.txt new file mode 100644 index 0000000..e4a4708 --- /dev/null +++ b/scikit_plot.egg-info/SOURCES.txt @@ -0,0 +1,18 @@ +LICENSE +MANIFEST.in +README.md +requirements.txt +scikit_plot.egg-info/PKG-INFO +scikit_plot.egg-info/SOURCES.txt +scikit_plot.egg-info/dependency_links.txt +scikit_plot.egg-info/requires.txt +scikit_plot.egg-info/top_level.txt +scikitplot/__init__.py +scikitplot/classifiers.py +scikitplot/cluster.py +scikitplot/clustering.py +scikitplot/decomposition.py +scikitplot/estimators.py +scikitplot/helpers.py +scikitplot/metrics.py +scikitplot/plotters.py \ No newline at end of file diff --git a/scikit_plot.egg-info/dependency_links.txt b/scikit_plot.egg-info/dependency_links.txt new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/scikit_plot.egg-info/dependency_links.txt @@ -0,0 +1 @@ + diff --git a/scikit_plot.egg-info/requires.txt b/scikit_plot.egg-info/requires.txt new file mode 100644 index 0000000..8c60616 --- /dev/null +++ b/scikit_plot.egg-info/requires.txt @@ -0,0 +1,7 @@ +matplotlib>=1.4.0 +scikit-learn>=0.18 +scipy>=0.9 +joblib>=0.10 + +[testing] +pytest diff --git a/scikit_plot.egg-info/top_level.txt b/scikit_plot.egg-info/top_level.txt new file mode 100644 index 0000000..93c3f70 --- /dev/null +++ b/scikit_plot.egg-info/top_level.txt @@ -0,0 +1 @@ +scikitplot diff --git a/scikitplot/__pycache__/__init__.cpython-36.pyc b/scikitplot/__pycache__/__init__.cpython-36.pyc new file mode 100644 index 0000000..5e7e02a Binary files /dev/null and b/scikitplot/__pycache__/__init__.cpython-36.pyc differ diff --git a/scikitplot/__pycache__/classifiers.cpython-36.pyc b/scikitplot/__pycache__/classifiers.cpython-36.pyc new file mode 100644 index 0000000..6eed39d Binary files /dev/null and b/scikitplot/__pycache__/classifiers.cpython-36.pyc differ diff --git a/scikitplot/__pycache__/cluster.cpython-36.pyc b/scikitplot/__pycache__/cluster.cpython-36.pyc new file mode 100644 index 0000000..c7a5c56 Binary files /dev/null and b/scikitplot/__pycache__/cluster.cpython-36.pyc differ diff --git a/scikitplot/__pycache__/clustering.cpython-36.pyc b/scikitplot/__pycache__/clustering.cpython-36.pyc new file mode 100644 index 0000000..c45854a Binary files /dev/null and b/scikitplot/__pycache__/clustering.cpython-36.pyc differ diff --git a/scikitplot/__pycache__/decomposition.cpython-36.pyc b/scikitplot/__pycache__/decomposition.cpython-36.pyc new file mode 100644 index 0000000..2340560 Binary files /dev/null and b/scikitplot/__pycache__/decomposition.cpython-36.pyc differ diff --git a/scikitplot/__pycache__/estimators.cpython-36.pyc b/scikitplot/__pycache__/estimators.cpython-36.pyc new file mode 100644 index 0000000..b0ca2f9 Binary files /dev/null and b/scikitplot/__pycache__/estimators.cpython-36.pyc differ diff --git a/scikitplot/__pycache__/helpers.cpython-36.pyc b/scikitplot/__pycache__/helpers.cpython-36.pyc new file mode 100644 index 0000000..dcd4db3 Binary files /dev/null and b/scikitplot/__pycache__/helpers.cpython-36.pyc differ diff --git a/scikitplot/__pycache__/metrics.cpython-36.pyc b/scikitplot/__pycache__/metrics.cpython-36.pyc new file mode 100644 index 0000000..7387136 Binary files /dev/null and b/scikitplot/__pycache__/metrics.cpython-36.pyc differ diff --git a/scikitplot/__pycache__/plotters.cpython-36.pyc b/scikitplot/__pycache__/plotters.cpython-36.pyc new file mode 100644 index 0000000..b8ed5cf Binary files /dev/null and b/scikitplot/__pycache__/plotters.cpython-36.pyc differ diff --git a/scikitplot/metrics.py b/scikitplot/metrics.py index 08ec693..cc0a532 100644 --- a/scikitplot/metrics.py +++ b/scikitplot/metrics.py @@ -1044,7 +1044,7 @@ def plot_calibration_curve(y_true, probas_list, clf_names=None, n_bins=10, def plot_cumulative_gain(y_true, y_probas, title='Cumulative Gains Curve', ax=None, figsize=None, title_fontsize="large", - text_fontsize="medium"): + text_fontsize="medium", class_names = None): """Generates the Cumulative Gains Plot from labels and scores/probabilities The cumulative gains chart is used to determine the effectiveness of a @@ -1076,6 +1076,10 @@ def plot_cumulative_gain(y_true, y_probas, title='Cumulative Gains Curve', text_fontsize (string or int, optional): Matplotlib-style fontsizes. Use e.g. "small", "medium", "large" or integer-values. Defaults to "medium". + + class_names (list of strings, optional): List of class names. Used for + the legend. Order should be synchronized with the order of classes + in y_probas. Returns: ax (:class:`matplotlib.axes.Axes`): The axes on which the plot was @@ -1096,8 +1100,9 @@ def plot_cumulative_gain(y_true, y_probas, title='Cumulative Gains Curve', """ y_true = np.array(y_true) y_probas = np.array(y_probas) - + classes = np.unique(y_true) + if class_names is None: class_names = classes if len(classes) != 2: raise ValueError('Cannot calculate Cumulative Gains for data with ' '{} category/ies'.format(len(classes))) @@ -1113,8 +1118,8 @@ def plot_cumulative_gain(y_true, y_probas, title='Cumulative Gains Curve', ax.set_title(title, fontsize=title_fontsize) - ax.plot(percentages, gains1, lw=3, label='Class {}'.format(classes[0])) - ax.plot(percentages, gains2, lw=3, label='Class {}'.format(classes[1])) + ax.plot(percentages, gains1, lw=3, label='Class {}'.format(class_names[0])) + ax.plot(percentages, gains2, lw=3, label='Class {}'.format(class_names[1])) ax.set_xlim([0.0, 1.0]) ax.set_ylim([0.0, 1.0]) @@ -1132,7 +1137,7 @@ def plot_cumulative_gain(y_true, y_probas, title='Cumulative Gains Curve', def plot_lift_curve(y_true, y_probas, title='Lift Curve', ax=None, figsize=None, title_fontsize="large", - text_fontsize="medium"): + text_fontsize="medium", class_names = None): """Generates the Lift Curve from labels and scores/probabilities The lift curve is used to determine the effectiveness of a @@ -1164,6 +1169,10 @@ def plot_lift_curve(y_true, y_probas, title='Lift Curve', text_fontsize (string or int, optional): Matplotlib-style fontsizes. Use e.g. "small", "medium", "large" or integer-values. Defaults to "medium". + + class_names (list of strings, optional): List of class names. Used for + the legend. Order should be synchronized with the order of classes + in y_probas. Returns: ax (:class:`matplotlib.axes.Axes`): The axes on which the plot was @@ -1186,6 +1195,7 @@ def plot_lift_curve(y_true, y_probas, title='Lift Curve', y_probas = np.array(y_probas) classes = np.unique(y_true) + if class_names is None: class_names = classes if len(classes) != 2: raise ValueError('Cannot calculate Lift Curve for data with ' '{} category/ies'.format(len(classes))) @@ -1208,8 +1218,8 @@ def plot_lift_curve(y_true, y_probas, title='Lift Curve', ax.set_title(title, fontsize=title_fontsize) - ax.plot(percentages, gains1, lw=3, label='Class {}'.format(classes[0])) - ax.plot(percentages, gains2, lw=3, label='Class {}'.format(classes[1])) + ax.plot(percentages, gains1, lw=3, label='Class {}'.format(class_names[0])) + ax.plot(percentages, gains2, lw=3, label='Class {}'.format(class_names[1])) ax.plot([0, 1], [1, 1], 'k--', lw=2, label='Baseline') diff --git a/scikitplot/tests/__pycache__/__init__.cpython-36.pyc b/scikitplot/tests/__pycache__/__init__.cpython-36.pyc new file mode 100644 index 0000000..2464a48 Binary files /dev/null and b/scikitplot/tests/__pycache__/__init__.cpython-36.pyc differ diff --git a/scikitplot/tests/__pycache__/test_classifiers.cpython-36-PYTEST.pyc b/scikitplot/tests/__pycache__/test_classifiers.cpython-36-PYTEST.pyc new file mode 100644 index 0000000..c108c78 Binary files /dev/null and b/scikitplot/tests/__pycache__/test_classifiers.cpython-36-PYTEST.pyc differ diff --git a/scikitplot/tests/__pycache__/test_cluster.cpython-36-PYTEST.pyc b/scikitplot/tests/__pycache__/test_cluster.cpython-36-PYTEST.pyc new file mode 100644 index 0000000..33eac8f Binary files /dev/null and b/scikitplot/tests/__pycache__/test_cluster.cpython-36-PYTEST.pyc differ diff --git a/scikitplot/tests/__pycache__/test_clustering.cpython-36-PYTEST.pyc b/scikitplot/tests/__pycache__/test_clustering.cpython-36-PYTEST.pyc new file mode 100644 index 0000000..300678f Binary files /dev/null and b/scikitplot/tests/__pycache__/test_clustering.cpython-36-PYTEST.pyc differ diff --git a/scikitplot/tests/__pycache__/test_decomposition.cpython-36-PYTEST.pyc b/scikitplot/tests/__pycache__/test_decomposition.cpython-36-PYTEST.pyc new file mode 100644 index 0000000..6e53b10 Binary files /dev/null and b/scikitplot/tests/__pycache__/test_decomposition.cpython-36-PYTEST.pyc differ diff --git a/scikitplot/tests/__pycache__/test_estimators.cpython-36-PYTEST.pyc b/scikitplot/tests/__pycache__/test_estimators.cpython-36-PYTEST.pyc new file mode 100644 index 0000000..662d479 Binary files /dev/null and b/scikitplot/tests/__pycache__/test_estimators.cpython-36-PYTEST.pyc differ diff --git a/scikitplot/tests/__pycache__/test_metrics.cpython-36-PYTEST.pyc b/scikitplot/tests/__pycache__/test_metrics.cpython-36-PYTEST.pyc new file mode 100644 index 0000000..3f75c09 Binary files /dev/null and b/scikitplot/tests/__pycache__/test_metrics.cpython-36-PYTEST.pyc differ diff --git a/scikitplot/tests/__pycache__/test_plotters.cpython-36-PYTEST.pyc b/scikitplot/tests/__pycache__/test_plotters.cpython-36-PYTEST.pyc new file mode 100644 index 0000000..9ed6778 Binary files /dev/null and b/scikitplot/tests/__pycache__/test_plotters.cpython-36-PYTEST.pyc differ