def _get_confusion_matrix_grid()

in src/responsibleai/rai_analyse/_score_card/classification_components.py [0:0]


def _get_confusion_matrix_grid(data):
    cm = data["confusion_matrix"]
    negative = data["classes"][0]
    positive = data["classes"][1]
    return table(
        tr(
            th(_class="header_cell"),
            th('Actual<br>"{}"'.format(positive), _class="header_cell"),
            th('Actual<br>"{}"'.format(negative), _class="header_cell"),
        ),
        tr(
            th('Predicted<br>"{}"'.format(positive), _class="header_cell"),
            td(
                p(
                    cm["tp"],
                    _style="font-size:22px; color:#107C10; text-align: center;",
                ),
                p(
                    "correct prediction",
                    _style="font-size:14px; text-align: center;",
                ),
                _class="cell",
            ),
            td(
                cm["fn"],
                _class="cell",
                _style="font-size:22px; color:#A80000; text-align: center;",
            ),
        ),
        tr(
            th('Predicted<br>"{}"'.format(negative), _class="header_cell"),
            td(
                cm["fp"],
                _class="cell",
                _style="font-size:22px; color:#A80000; text-align: center;",
            ),
            td(
                p(
                    cm["tn"],
                    _style="font-size:22px; color:#107C10; text-align: center;",
                ),
                p(
                    "correct prediction",
                    _style="font-size:14px; text-align: center;",
                ),
                _class="cell",
            ),
        ),
        _style="width: 5in",
    )