class_docstr: Visualizes how precision, recall, f1 score, and queue rate change as the
  discrimination threshold increases. For probabilistic, binary classifiers,
  the discrimination threshold is the probability at which you choose the
  positive class over the negative. Generally this is set to 50%, but
  adjusting the discrimination threshold will adjust sensitivity to false
  positives which is described by the inverse relationship of precision and
  recall with respect to the threshold.
  
  The visualizer also accounts for variability in the model by running
  multiple trials with different train and test splits of the data. The
  variability is visualized using a band such that the curve is drawn as the
  median score of each trial and the band is from the 10th to 90th
  percentile.
  
  The visualizer is intended to help users determine an appropriate
  threshold for decision making (e.g. at what threshold do we have a human
  review the data), given a tolerance for precision and recall or limiting
  the number of records to check (the queue rate).
  
  Parameters
  ----------
  estimator : estimator
      A scikit-learn estimator that should be a classifier. If the model is
      not a classifier, an exception is raised. If the internal model is not
      fitted, it is fit when the visualizer is fitted, unless otherwise specified
      by ``is_fitted``.
  
  ax : matplotlib Axes, default: None
      The axes to plot the figure on. If not specified the current axes will be
      used (or generated if required).
  
  n_trials : integer, default: 50
      Number of times to shuffle and split the dataset to account for noise
      in the threshold metrics curves. Note if cv provides > 1 splits,
      the number of trials will be n_trials * cv.get_n_splits()
  
  cv : float or cross-validation generator, default: 0.1
      Determines the splitting strategy for each trial. Possible inputs are:
  
      - float, to specify the percent of the test split
      - object to be used as cross-validation generator
  
      This attribute is meant to give flexibility with stratified splitting
      but if a splitter is provided, it should only return one split and
      have shuffle set to True.
  
  fbeta : float, 1.0 by default
      The strength of recall versus precision in the F-score.
  
  argmax : str or None, default: 'fscore'
      Annotate the threshold maximized by the supplied metric (see exclude
      for the possible metrics to use). If None or passed to exclude,
      will not annotate the graph.
  
  exclude : str or list, optional
      Specify metrics to omit from the graph, can include:
  
      - ``"precision"``
      - ``"recall"``
      - ``"queue_rate"``
      - ``"fscore"``
  
      Excluded metrics will not be displayed in the graph, nor will they
      be available in ``thresholds_``; however, they will be computed on fit.
  
  quantiles : sequence, default: np.array([0.1, 0.5, 0.9])
      Specify the quantiles to view model variability across a number of
      trials. Must be monotonic and have three elements such that the first
      element is the lower bound, the second is the drawn curve, and the
      third is the upper bound. By default the curve is drawn at the median,
      and the bounds from the 10th percentile to the 90th percentile.
  
  random_state : int, optional
      Used to seed the random state for shuffling the data while composing
      different train and test splits. If supplied, the random state is
      incremented in a deterministic fashion for each split.
  
      Note that if a splitter is provided, it's random state will also be
      updated with this random state, even if it was previously set.
  
  is_fitted : bool or str, default="auto"
      Specify if the wrapped estimator is already fitted. If False, the estimator
      will be fit when the visualizer is fit, otherwise, the estimator will not be
      modified. If "auto" (default), a helper method will check if the estimator
      is fitted before fitting it again.
  
  force_model : bool, default: False
      Do not check to ensure that the underlying estimator is a classifier. This
      will prevent an exception when the visualizer is initialized but may result
      in unexpected or unintended behavior.
  
  kwargs : dict
      Keyword arguments passed to the visualizer base classes.
  
  Attributes
  ----------
  thresholds_ : array
      The uniform thresholds identified by each of the trial runs.
  
  cv_scores_ : dict of arrays of ``len(thresholds_)``
      The values for all included metrics including the upper and lower
      bounds of the metrics defined by quantiles.
  
  Notes
  -----
  The term "discrimination threshold" is rare in the literature. Here, we
  use it to mean the probability at which the positive class is selected
  over the negative class in binary classification.
  
  Classification models must implement either a ``decision_function`` or
  ``predict_proba`` method in order to be used with this class. A
  ``YellowbrickTypeError`` is raised otherwise.
  
  .. caution:: This method only works for binary, probabilistic classifiers.
  
  .. seealso::
      For a thorough explanation of discrimination thresholds, see:
      `Visualizing Machine Learning Thresholds to Make Better Business
      Decisions
      <http://blog.insightdatalabs.com/visualizing-classifier-thresholds/>`_
      by Insight Data.
docstr: Sets a title and axis labels on the visualizer and ensures that the
  axis limits are scaled to valid threshold values.
  
  Parameters
  ----------
  kwargs: generic keyword arguments.
  
  Notes
  -----
  Generally this method is called from show and not directly by the user.
docstr_tok: ["Sets","a","title","and","axis","labels","on","the","visualizer","and","ensures","that","the","axis","limits","are","scaled","to","valid","threshold","values",".","Parameters","--","--","--","--","--","kwargs",":","generic","keyword","arguments",".","Notes","--","--","-","Generally","this","method","is","called","from","show","and","not","directly","by","the","user","."]
code: def finalize(self, **kwargs):
      """
      Sets a title and axis labels on the visualizer and ensures that the
      axis limits are scaled to valid threshold values.
  
      Parameters
      ----------
      kwargs: generic keyword arguments.
  
      Notes
      -----
      Generally this method is called from show and not directly by the user.
      """
      super(DiscriminationThreshold, self).finalize(**kwargs)
  
      # Set the title of the threshold visualiztion
      self.set_title("Threshold Plot for {}".format(self.name))
  
      self.ax.legend(frameon=True, loc="best")
      self.ax.set_xlabel("discrimination threshold")
      self.ax.set_ylabel("score")
      self.ax.set_xlim(0.0, 1.0)
      self.ax.set_ylim(0.0, 1.0)
  
imports: import bisect
  import numpy
  from scipy.stats import mstats
  from collections import defaultdict
  from sklearn.base import clone
  from sklearn.utils import indexable
  from sklearn.model_selection import ShuffleSplit
  from sklearn.metrics import precision_recall_curve
  from sklearn.utils.multiclass import type_of_target
  from yellowbrick.base import ModelVisualizer
  from yellowbrick.style.colors import resolve_colors
  from yellowbrick.utils import is_classifier, is_monotonic, is_probabilistic
  from yellowbrick.exceptions import YellowbrickTypeError, YellowbrickValueError
label_desc: Use image node_id 5 for calling the DiscriminationThreshold obj's underlying member method code with example usage: obj.finalize() without return types