所以我有一些 8 列和多行的数据,我想用 5 个拆分执行 K-Fold 拆分。我已经做到了,但是我现在要做的是对于每个拆分,打印出它所在的拆分编号。请参阅代码以获得更好的解释。
kf = KFold(n_splits=5) #Define the split - into 5 folds
#Define empty arrays for each technique
kf_train = []
kf_test = []
#Iterate through each feature in
for kf_train, kf_test in kf.split(df):
print('Split # ????')
for col_name, col_data in df.iteritems():
print('Feature: ', col_name)
print('Mean: ', np.mean(col_data))
print('Standard Deviation: ', np.std(col_data))
print('\n')
所以它说print('Split # ????')
的就是我遇到问题的地方。为了获得以下输出,我应该写什么:
Split #1
Feature: XXX
Mean: 3.3
Std: 3.3
Split #2
etc..