【发布时间】:2021-05-19 14:03:37
【问题描述】:
我有多目标问题。我有两个目标ylo 和yhi 共享相同的功能x:
x = np.array([[0,1,2],[2,3,4]])
ylo = np.array([10,11])
yhi = np.array([12,13])
有没有办法从sklearn.model_selection.train_test_split 拆分数据以得到x_train、x_test、ylo_train、ylo_test、yhi_train、yhi_test?还是有其他更好的功能?
到目前为止,我必须进行两次拆分:
X_train, X_test, ylo_train, ylo_test = train_test_split(
X, ylo,test_size=0.19, random_state=1)
_, _, yhi_train, yhi_test = train_test_split(
X, yhi,test_size=0.19, random_state=1)
【问题讨论】:
标签: python scikit-learn train-test-split