K倍交叉验证在k个最近的邻居中

时间:2018-11-12 07:19:54

标签: python-3.x machine-learning scikit-learn cross-validation

我在k个最近的邻居中重复进行K折以进行交叉验证。在进行交叉验证后,我需要获取一些指标来了解kNN的性能。

from sklearn.model_selection import RepeatedKFold
rkf = RepeatedKFold(n_splits=5, n_repeats=10, random_state=None)
# X is the feature set and y is the target
for train_index, test_index in rkf.split(X):
     print("Train:", train_index, "Validation:",test_index)
     X_train, X_test = X[train_index], X[test_index]
     y_train, y_test = y[train_index], y[test_index]

完成此步骤后,我感到困惑。我认为我必须找到所有交叉验证得分的平均值。我如何从这里找到k,其中k是否。邻居?

0 个答案:

没有答案