:py:mod:`src.plots`
===================

.. py:module:: src.plots


Module Contents
---------------

Classes
~~~~~~~

.. autoapisummary::

   src.plots.Plotter




Attributes
~~~~~~~~~~

.. autoapisummary::

   src.plots.K
   src.plots.V


.. py:data:: K

   

.. py:data:: V

   

.. py:class:: Plotter(**data: Any)


   Bases: :py:obj:`pydantic.BaseModel`, :py:obj:`abc.ABC`

   Helper class that provides a standard way to create an ABC using
   inheritance.

   .. py:attribute:: max_alpha
      :type: float

      

   .. py:attribute:: default_alpha
      :type: float

      

   .. py:attribute:: min_boots_in_one_tail
      :type: int

      

   .. py:attribute:: metric
      :type: Callable[[numpy.typing.NDArray[numpy.float32], numpy.typing.NDArray[numpy.float32]], float]

      

   .. py:attribute:: _initial_alpha
      :type: float

      

   .. py:attribute:: _min_n_boots
      :type: int

      

   .. py:attribute:: _n_boots
      :type: int

      

   .. py:attribute:: _alpha
      :type: float

      

   .. py:method:: validate_alphas(v: dict[str, float]) -> dict[str, float]

      Validate the alphas when initiate the Plotter object.

      :param v: a dictionary includes default_alpha and max_alpha, and their values
      :type v: dict[str, float]
      :raises ValueError: if default_alpha is grater than 0.5
      :raises ValueError: if default_alpha is not in between 0 and max_alpha
      :return: a dictionary includes validated default_alpha and max_alpha, and their values
      :rtype: dict[str, float]


   .. py:method:: preprocess_inputs(results: pandas.DataFrame) -> pandas.DataFrame

      Drop the row as long as it contain NA value.

      :param results: input dataframe
      :type results: DataFrame
      :return: output dataframe
      :rtype: DataFrame


   .. py:method:: __call__(predictions: dict[K, V], labels: dict[K, V])


   .. py:method:: combine_inputs(labels: dict[K, V], predictions: dict[K, V]) -> pandas.DataFrame
      :staticmethod:

      Combine input labels and input predictions, and return it as dataframe.

      :param labels: input dictionary of labels
      :type labels: dict[K, V]
      :param predictions: input dictionary of predictions
      :type predictions: dict[K, V]
      :return: the combined dataframe of input labels and input predictions
      :rtype: DataFrame


   .. py:method:: _one_boot(y_true: numpy.typing.NDArray[numpy.float32], y_pred: numpy.typing.NDArray[numpy.float32]) -> tuple[numpy.typing.NDArray[numpy.float32], numpy.typing.NDArray[numpy.float32]]

      Usage: (t, p) = one_boot(true, pred) with true, pred, t, p arrays of same length


   .. py:method:: _boot_generator(y_true: numpy.typing.NDArray[Any], y_pred: numpy.typing.NDArray[Any])


   .. py:method:: _min_n_boots_from(alpha: float) -> int


   .. py:method:: _min_alpha_from(n_boots: int) -> float


   .. py:method:: metric_boot_histogram(y_true, y_pred)

      Plot histogram with lines for 1 observed metric and its confidence interval.

      :param y_true: True labels.
      :type y_true: ndarray
      :param y_pred: The predictions.
      :type y_pred: ndarray



