我正在尝试预测塑性流体的粘度,我使用了随机森林回归和K折交叉验证来训练我的数据。
RFR = RandomForestRegressor(n_estimators = 2000,max_depth = 20, n_jobs=-1, random_state = 0)
scores = []
Kfold = StratifiedKFold(n_splits=10, random_state = 0, shuffle=True)
for i in range(10):
result = next(Kfold.split(X_train), None)
input_train = df.iloc[result[0]]
input_test = df.iloc[result[1]]
output_train = y.iloc[result[0]]
output_test = y.iloc[result[1]]
model = RFR.fit(input_train,output_train)
predictions = RFR.predict(input_test)
scores.append(model.score(input_test,output_test))
print('Scores from each Iteration: ', scores)
print('Average K-Fold Score :' , np.mean(scores))
我想训练我的模型进行10倍交叉验证,但是我收到了此错误消息:
TypeError: split() missing 1 required positional argument: 'y'