def get_confusion_table(y_pred, y_test, relations):
    """
    Get the confusion table.
    :param y_pred:
    :param y_test:
    :return: {actual_class1: {pred_class1: number, pred_class2: number, ...}, actual_class2, ...}
    """
    confusion_table = {}
    for actual_relation in relations:
        confusion_table[actual_relation] = {}
        for pred_relation in relations:
            confusion_table[actual_relation][pred_relation] = 0

    for i, relation in enumerate(y_test):
        relation_pred = y_pred[i]
        confusion_table[relation][relation_pred] += 1
    return confusion_table