def get_confusion_matrix(self, values: np.ndarray) -> dict:
    '\n        Computes and returns a json object that contains the confusion matrix for each class.\n\n        :param values: Array indicating the correctness of each assignment in the ith class.\n        :return: Json object with confusion matrix per-class.\n        '
    dic_class = {}
    true_positive = np.where((values == 0))[0].shape[0]
    true_negative = np.where((values == 1))[0].shape[0]
    false_positive = np.where((values == 2))[0].shape[0]
    false_negative = np.where((values == 3))[0].shape[0]
    tp_rate = self.calculate_and_print(true_positive, (true_positive + false_negative), 'true-positive rate')
    tn_rate = self.calculate_and_print(true_negative, (false_positive + true_negative), 'true-negative rate')
    fp_rate = self.calculate_and_print(false_positive, (false_positive + true_negative), 'false-positive rate')
    fn_rate = self.calculate_and_print(false_negative, (true_positive + false_negative), 'false-negative rate')
    dic_tp = dict(rate=round(tp_rate, 2), numerator=true_positive, denominator=(true_positive + false_negative))
    if ((true_positive + false_negative) == 0):
        dic_tp = dict(rate='N/A', numerator=true_positive, denominator=(true_positive + false_negative))
    dic_tn = dict(rate=round(tn_rate, 2), numerator=true_negative, denominator=(false_positive + true_negative))
    if ((false_positive + true_negative) == 0):
        dic_tn = dict(rate='N/A', numerator=true_negative, denominator=(false_positive + true_negative))
    dic_fp = dict(rate=round(fp_rate, 2), numerator=false_positive, denominator=(false_positive + true_negative))
    if ((false_positive + true_negative) == 0):
        dic_fp = dict(rate='N/A', numerator=false_positive, denominator=(false_positive + true_negative))
    dic_fn = dict(rate=round(fn_rate, 2), numerator=false_negative, denominator=(true_positive + false_negative))
    if ((true_positive + false_negative) == 0):
        dic_fn = dict(rate='N/A', numerator=false_negative, denominator=(true_positive + false_negative))
    dic_class.update(dict(TruePositive=dic_tp))
    dic_class.update(dict(TrueNegative=dic_tn))
    dic_class.update(dict(FalsePositive=dic_fp))
    dic_class.update(dict(FalseNegative=dic_fn))
    return dic_class
Computes and returns a json object that contains the confusion matrix for each class.

:param values: Array indicating the correctness of each assignment in the ith class.
:return: Json object with confusion matrix per-class.
def get_confusion_matrix(self, values: np.ndarray) -> dict:
    '\n        Computes and returns a json object that contains the confusion matrix for each class.\n\n        :param values: Array indicating the correctness of each assignment in the ith class.\n        :return: Json object with confusion matrix per-class.\n        '
    dic_class = {}
    true_positive = np.where((values == 0))[0].shape[0]
    true_negative = np.where((values == 1))[0].shape[0]
    false_positive = np.where((values == 2))[0].shape[0]
    false_negative = np.where((values == 3))[0].shape[0]
    tp_rate = self.calculate_and_print(true_positive, (true_positive + false_negative), 'true-positive rate')
    tn_rate = self.calculate_and_print(true_negative, (false_positive + true_negative), 'true-negative rate')
    fp_rate = self.calculate_and_print(false_positive, (false_positive + true_negative), 'false-positive rate')
    fn_rate = self.calculate_and_print(false_negative, (true_positive + false_negative), 'false-negative rate')
    dic_tp = dict(rate=round(tp_rate, 2), numerator=true_positive, denominator=(true_positive + false_negative))
    if ((true_positive + false_negative) == 0):
        dic_tp = dict(rate='N/A', numerator=true_positive, denominator=(true_positive + false_negative))
    dic_tn = dict(rate=round(tn_rate, 2), numerator=true_negative, denominator=(false_positive + true_negative))
    if ((false_positive + true_negative) == 0):
        dic_tn = dict(rate='N/A', numerator=true_negative, denominator=(false_positive + true_negative))
    dic_fp = dict(rate=round(fp_rate, 2), numerator=false_positive, denominator=(false_positive + true_negative))
    if ((false_positive + true_negative) == 0):
        dic_fp = dict(rate='N/A', numerator=false_positive, denominator=(false_positive + true_negative))
    dic_fn = dict(rate=round(fn_rate, 2), numerator=false_negative, denominator=(true_positive + false_negative))
    if ((true_positive + false_negative) == 0):
        dic_fn = dict(rate='N/A', numerator=false_negative, denominator=(true_positive + false_negative))
    dic_class.update(dict(TruePositive=dic_tp))
    dic_class.update(dict(TrueNegative=dic_tn))
    dic_class.update(dict(FalsePositive=dic_fp))
    dic_class.update(dict(FalseNegative=dic_fn))
    return dic_class