【发布时间】:2020-04-03 16:40:54
【问题描述】:
在我从 sklearn Stratifiednfold 返回的索引中,如何从每个折叠创建相应的数据帧?
skf = StratifiedKFold(n_splits=10)
skf.get_n_splits(X, y)
for train_index, test_index in skf.split(X, y):
print("TRAIN:", train_index, "TEST:", test_index)
打印出带有索引的列表。如何将这些映射回我原来的 Dataframe?
我需要它们,因为我想在训练数据上运行我的 texclassification 模型之前将我的增强数据添加到训练数据中。
【问题讨论】:
标签: python-3.x pandas machine-learning scikit-learn text-classification