(pred_matrix, label_matrix)
return np.mean(match)
Args:
        pred_matrix: prediction matrix shape of (data_num, class_num), type of int
        label_matrix: true label matrix, same shape and type as pred_matrix

    Returns:
        accuracy: accuracy of the prediction, type float
Args:
        pred_matrix: prediction matrix shape of (data_num, class_num), type of int
        label_matrix: true label matrix, same shape and type as pred_matrix
Args : pred_matrix : prediction matrix shape of ( data_num class_num ) type of int label_matrix : true label matrix same shape and type as pred_matrix
def calculate_accuracy_multi(pred_matrix, label_matrix):
    """
    Args:
        pred_matrix: prediction matrix shape of (data_num, class_num), type of int
        label_matrix: true label matrix, same shape and type as pred_matrix

    Returns:
        accuracy: accuracy of the prediction, type float
    """
    if np.ndim(pred_matrix) != 2 or np.ndim(label_matrix) != 2:
        raise TypeError('require rank 2, 2. get {}, {}'.format(np.rank(pred_matrix), np.rank(label_matrix)))
    if len(pred_matrix) != len(label_matrix):
        raise TypeError('first argument and second argument have different length')

    match = [np.array_equal(pred_matrix[i], label_matrix[i]) for i in range(len(label_matrix))]

    return np.mean(match)
def calculate_accuracy_multi ( pred_matrix , label_matrix ) : if np . ndim ( pred_matrix ) != 2 or np . ndim ( label_matrix ) != 2 : raise TypeError ( 'require rank 2, 2. get {}, {}' . format ( np . rank ( pred_matrix ) , np . rank ( label_matrix ) ) ) if len ( pred_matrix ) != len ( label_matrix ) : raise TypeError ( 'first argument and second argument have different length' ) match = [ np . array_equal ( pred_matrix [ i ] , label_matrix [ i ] ) for i in range ( len ( label_matrix ) ) ] return np . mean ( match )