首页 > 解决方案 > 如何在不使用函数 train_test_split 的情况下将数据拆分为测试和训练?

问题描述

我目前正在进行时间序列预测,我必须将数据分成训练集和测试集。(让前 70% 的数据在训练集中)

但是,我不能使用 train_test_split 函数,因为它会打乱行。我还能如何拆分数据

标签: pythonscikit-learntrain-test-split

解决方案


您实际上可以使用 train_test_split ,但设置shuffle = False

https://scikit-learn.org/stable/modules/generated/sklearn.model_selection.train_test_split.html


推荐阅读