CV, final_accuracy = 0, 0
SKF = KFold(len(y_data), n_splits=10, shuffle=True, random_state=42)
for train_indices, test_indices in SKF:
x_train_pre = x_data[train_indices]
y_train_pre = y_data[train_indices]
x_test = x_data[test_indices]
y_test = y_data[test_indices]
x_train, x_dev, y_train, y_dev = train_test_split(x_train_pre, y_train_pre, test_size=0.1, random_state=0)
TypeError: init() got multiple values for argument 'n_splits'
SKF = KFold(len(y_data), n_splits=10, shuffle=True, random_state=42)
改成
t=KFold( n_splits=10, shuffle=True, random_state=42)
t.get_n_splits(len(y_data))
n_splits 是第一个参数 , len(y_data) 已经被认为是 n_splits了,所以 n_splits 就不再给值了。
你的 len(y_data) 就是10?