<NME> predictions.py
<BEF> """
The :mod:`surprise.prediction_algorithms.predictions` module defines the
:class:`Prediction` named tuple and the :class:`PredictionImpossible`
exception.
"""


from collections import namedtuple


class PredictionImpossible(Exception):
    r"""Exception raised when a prediction is impossible.

    When raised, the estimation :math:`\hat{r}_{ui}` is set to the global mean
    of all ratings :math:`\mu`.
    """

    pass


class Prediction(namedtuple("Prediction", ["uid", "iid", "r_ui", "est", "details"])):
    """A named tuple for storing the results of a prediction.

    It's wrapped in a class, but only for documentation and printing purposes.

    Args:
    It's wrapped in a class, but only for documentation and printing purposes.

    Args:
        uid: The (inner) user id. See :ref:`this note<raw_inner_note>`.
        iid: The (inner) item id. See :ref:`this note<raw_inner_note>`.
        r_ui(float): The true rating :math:`r_{ui}`.
        est(float): The estimated rating :math:`\\hat{r}_{ui}`.
        details (dict): Stores additional details about the prediction that
    __slots__ = ()  # for memory saving purpose.

    def __str__(self):
        s = f"user: {self.uid:<10} "
        s += f"item: {self.iid:<10} "
        if self.r_ui is not None:
            s += f"r_ui = {self.r_ui:1.2f}   "
        else:
            s += "r_ui = None   "
        s += f"est = {self.est:1.2f}   "
        s += str(self.details)

        return s

<MSG> user and item ids are actually raw ids in a Prediction object

<DFF> @@ -27,8 +27,8 @@ class Prediction(namedtuple('Prediction',
     It's wrapped in a class, but only for documentation and printing purposes.
 
     Args:
-        uid: The (inner) user id. See :ref:`this note<raw_inner_note>`.
-        iid: The (inner) item id. See :ref:`this note<raw_inner_note>`.
+        uid: The (raw) user id. See :ref:`this note<raw_inner_note>`.
+        iid: The (raw) item id. See :ref:`this note<raw_inner_note>`.
         r_ui(float): The true rating :math:`r_{ui}`.
         est(float): The estimated rating :math:`\\hat{r}_{ui}`.
         details (dict): Stores additional details about the prediction that

{'addition_count': 2, 'commit_subject': 'user and item ids are actually raw ids in a Prediction object', 'deletion_count': 2, 'file_extension': '.py', 'lang': 'py', 'license': 'bsd-3-clause', 'repo_name': 'NicolasHug/Surprise'}