Skip to content

Prediction

Bases: StaticCollection

An object describing a prediction (e.g., a machine-drawn bounding box on an image).

Attributes:

Name Type Description
datum Datum

The datum associated with the prediction.

annotations List[Annotation]

The list of annotations associated with the prediction.

Examples:

>>> Prediction(
...     datum=Datum(uid="uid1"),
...     annotations=[
...         Annotation(
...             labels=[
...                 Label(key="k1", value="v1", score=0.9),
...                 Label(key="k1", value="v1", score=0.1)
...             ],
...         )
...     ]
... )
Source code in valor/coretypes.py
class Prediction(StaticCollection):
    """
    An object describing a prediction (e.g., a machine-drawn bounding box on an image).

    Attributes
    ----------
    datum : Datum
        The datum associated with the prediction.
    annotations : List[Annotation]
        The list of annotations associated with the prediction.

    Examples
    --------
    >>> Prediction(
    ...     datum=Datum(uid="uid1"),
    ...     annotations=[
    ...         Annotation(
    ...             labels=[
    ...                 Label(key="k1", value="v1", score=0.9),
    ...                 Label(key="k1", value="v1", score=0.1)
    ...             ],
    ...         )
    ...     ]
    ... )
    """

    datum: Datum = Datum.symbolic(owner="prediction", name="datum")
    annotations: SymbolicList[Annotation] = SymbolicList[Annotation].symbolic(
        owner="prediction", name="annotations"
    )

    def __init__(
        self,
        *,
        datum: Datum,
        annotations: List[Annotation],
    ):
        """
        Creates a prediction.

        Parameters
        ----------
        datum : Datum
            The datum that the prediction is operating over.
        annotations : List[Annotation]
            The list of predicted annotations.
        """
        super().__init__(datum=datum, annotations=annotations)

Functions

valor.Prediction.__init__(*, datum, annotations)

Creates a prediction.

Parameters:

Name Type Description Default
datum Datum

The datum that the prediction is operating over.

required
annotations List[Annotation]

The list of predicted annotations.

required
Source code in valor/coretypes.py
def __init__(
    self,
    *,
    datum: Datum,
    annotations: List[Annotation],
):
    """
    Creates a prediction.

    Parameters
    ----------
    datum : Datum
        The datum that the prediction is operating over.
    annotations : List[Annotation]
        The list of predicted annotations.
    """
    super().__init__(datum=datum, annotations=annotations)