多个目标的 train_test_split

问题描述

我有多目标问题。我有两个目标 yloyhi 共享相同的功能 x

x = np.array([[0,1,2],[2,3,4]])
ylo = np.array([10,11])
yhi = np.array([12,13])

有没有办法拆分数据以从 {x_train,x_test,ylo_train,ylo_test,yhi_train,yhi_test {1}}?或者有其他更好的功能吗?

到目前为止,我必须进行两次拆分:

sklearn.model_selection.train_test_split

解决方法

您可以将它们放在一个数据框中,然后只对各个列进行训练

{{1}}