.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "glr_examples/view/plot_pr.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code or to run this example in your browser via Binder .. rst-class:: sphx-glr-example-title .. _sphx_glr_glr_examples_view_plot_pr.py: ================================================= Plot Precision-Recall (PR) ================================================= computes the score based on the decision function and plot the result as a score vs threshold. .. GENERATED FROM PYTHON SOURCE LINES 9-12 .. code-block:: Python # Author: L.Kouadio # Licence: BSD-3-clause .. GENERATED FROM PYTHON SOURCE LINES 13-25 .. code-block:: Python from watex.exlib.sklearn import SGDClassifier from watex.datasets.dload import load_bagoue from watex.utils import cattarget from watex.view.mlplot import EvalPlot X , y = load_bagoue(as_frame =True ) sgd_clf = SGDClassifier(random_state= 42) # our estimator b= EvalPlot(scale = True , encode_labels=True) b.fit_transform(X, y) # binarize the label b.y ybin = cattarget(b.y, labels= 2 ) # can also use labels =[0, 1] b.y = ybin # plot the Precision-recall tradeoff b.plotPR(sgd_clf , label =1) # class=1 .. image-sg:: /glr_examples/view/images/sphx_glr_plot_pr_001.png :alt: plot pr :srcset: /glr_examples/view/images/sphx_glr_plot_pr_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none EvalPlot(tname= None, objective= None, scale= True, ... , sns_height= 4.0, sns_aspect= 0.7, verbose= 0) .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.360 seconds) .. _sphx_glr_download_glr_examples_view_plot_pr.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: binder-badge .. image:: images/binder_badge_logo.svg :target: https://mybinder.org/v2/gh/watex/watex/0.3.X?urlpath=lab/tree/notebooks/glr_examples/view/plot_pr.ipynb :alt: Launch binder :width: 150 px .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_pr.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_pr.py ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_