tombolo.plots.prediction_table

 1import jsonschema
 2import matplotlib.pyplot as plt
 3
 4from .primitives.grid import _grid
 5
 6_matrix = {
 7    "type": "object",
 8    "additionalProperties": {
 9        "type": "object",
10        "additionalProperties": {"type": ["number", "null"]},
11    },
12}
13
14_schema = {
15    "type": "object",
16    "required": ["prediction"],
17    "properties": {
18        "prediction": {
19            "type": "object",
20            "required": ["lower", "upper"],
21            "properties": {"lower": _matrix, "upper": _matrix},
22        }
23    },
24}
25
26
27def prediction_table(data: dict) -> plt.Figure:
28    """Grid of prediction intervals. Only applicable to NMA results.
29
30    Args:
31        data: Result dict from `tombolo.nma`. Only `prediction` is used.
32
33    Returns:
34        A matrix where each cell shows the 95% prediction interval for the row
35        treatment relative to the column treatment.
36    """
37    jsonschema.validate(instance=data, schema=_schema)
38    return _grid(data["prediction"])
def prediction_table(data: dict) -> matplotlib.figure.Figure:
28def prediction_table(data: dict) -> plt.Figure:
29    """Grid of prediction intervals. Only applicable to NMA results.
30
31    Args:
32        data: Result dict from `tombolo.nma`. Only `prediction` is used.
33
34    Returns:
35        A matrix where each cell shows the 95% prediction interval for the row
36        treatment relative to the column treatment.
37    """
38    jsonschema.validate(instance=data, schema=_schema)
39    return _grid(data["prediction"])

Grid of prediction intervals. Only applicable to NMA results.

Args: data: Result dict from tombolo.nma. Only prediction is used.

Returns: A matrix where each cell shows the 95% prediction interval for the row treatment relative to the column treatment.