https://scikit-learn.org/stable/modules/generated/sklearn.metrics.classification_report.html
Я получаю сообщение об ошибке с отчетом о классификации sklearn.
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-30-6a63be1ce4c8> in <module>
----> 1 classification_report(y_test, predictions)
/usr/local/lib/python3.7/site-packages/sklearn/metrics/classification.py in classification_report(y_true, y_pred, labels, target_names, sample_weight, digits, output_dict)
1522 """
1523
-> 1524 y_type, y_true, y_pred = _check_targets(y_true, y_pred)
1525
1526 labels_given = True
/usr/local/lib/python3.7/site-packages/sklearn/metrics/classification.py in _check_targets(y_true, y_pred)
69 y_pred : array or indicator matrix
70 """
---> 71 check_consistent_length(y_true, y_pred)
72 type_true = type_of_target(y_true)
73 type_pred = type_of_target(y_pred)
/usr/local/lib/python3.7/site-packages/sklearn/utils/validation.py in check_consistent_length(*arrays)
233 if len(uniques) > 1:
234 raise ValueError("Found input variables with inconsistent numbers of"
--> 235 " samples: %r" % [int(l) for l in lengths])
236
237
ValueError: Found input variables with inconsistent numbers of samples: [360, 144]
Это единственное, что я передаю, и y_test.shape - это (360,), а предсказания - это (144,).
classification_report(y_test, predictions)
Должны ли они быть одинаковой длины? (Я так полагаю из-за этой второй трассировки стека). Если это так, как длина X и Y может быть одинаковой при разделении данных? Разве они не всегда будут разной длины?