Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
705 B
13
Indexable
Never
def acc(y_true, y_pred):
    
    true_counter = 0

    for row_true in range(len(y_true)):
        for row_pred in range(len(y_pred)):
            if y_true.loc[row_true, 'Дата донации'] == y_pred.loc[row_pred, 'Дата донации']:
                true_temp_counter = 1
                if y_true.loc[row_true, 'Класс крови'] == y_pred.loc[row_pred, 'Класс крови']:
                    true_temp_counter += 1
                if y_true.loc[row_true, 'Тип донации'] == y_pred.loc[row_pred, 'Тип донации']:
                    true_temp_counter += 1
                true_counter += true_temp_counter/3
    return true_counter/len(y_true)