Получение ошибки:
Файл "C: \ Users \ Oskar \ anaconda3 \ lib \ site-packages \ sklearn \ metrics_classification.py", строка 90, в _check_targets "и {1} целях ".format (type_true, type_pred))
ValueError: Метрики классификации не могут обрабатывать сочетание целей многоклассового вывода и многозначного индикатора
Хотелось бы помощи!
if ml_type == 'classification':
preds_train = kNeigh.predict(X_train)
preds_test = kNeigh.predict(X_test)
cutoff = 0.7
yTrain = np.zeros_like(preds_train)
yTrain[preds_train > cutoff] = 1
yTest= np.zeros_like(preds_test)
yTest[preds_test > cutoff] = 1
#preds_train=np.argmax(preds_train, axis=1)
#preds_test=np.argmax(preds_test, axis=1)
train_f1 = f1_score(y_train, np.round(yTrain))
train_precision = precision_score(y_train, np.round(yTrain))
train_recall = recall_score(y_train, np.round(yTrain))
test_f1 = f1_score(y_test, np.round(yTest)),
test_precision = precision_score(y_test, np.round(yTest))
test_recall = recall_score(y_test, np.round(yTest))
print('knn TRAIN: f1_score={}, precision={}, recall={}'.format(train_f1, train_precision, train_recall))
print('knn TEST: f1_score={}, precision={}, recall={}'.format(test_f1, test_precision, test_recall))