您好,我正在尝试创建一个具有较高召回率和精确度值的员工晋升aloghritim,试图拟合我的模型但出现此错误
请在下方提供帮助,这是到目前为止我与我的作品的协作链接
https://colab.research.google.com/drive/1ugKUswSjwnrfActsu2E-1gSg94ylwUJK

import catboost as ctb
from sklearn import metrics
    # fit a CART model to the data
parameters = {'depth'         : [6,8,10],
                  'learning_rate' : [0.01, 0.05, 0.1],
                  'iterations'    : [30, 50, 100]
                 }
model = ctb.CatBoostClassifier(silent=True)
model.fit(X_train, y_train)
print(); print(model)


     # make predictions
expected_y  = y_train
predicted_y = model.predict(X_test)

    # summarize the fit of the model
print(); print(metrics.classification_report(expected_y, predicted_y))
print(); print(metrics.confusion_matrix(expected_y, predicted_y))
ValueError                                Traceback (most recent call last)
<ipython-input-26-abdfdbe585e3> in <module>()
     16
     17     # summarize the fit of the model
---> 18 print(); print(metrics.classification_report(expected_y, predicted_y))
     19 print(); print(metrics.confusion_matrix(expected_y, predicted_y))

2 frames
/usr/local/lib/python3.6/dist-packages/sklearn/utils/validation.py in check_consistent_length(*arrays)
    203     if len(uniques) > 1:
    204         raise ValueError("Found input variables with inconsistent numbers of"
--> 205                          " samples: %r" % [int(l) for l in lengths])
    206
    207

ValueError: Found input variables with inconsistent numbers of samples: [30649, 7663]

最佳答案

根据您的缩写,我认为应该是

expected_y = y_test


代替

expected_y  = y_train

10-01 20:27