Slide 66
Slide 66 text
3-7. テストデータと訓練データへの切り
分けを行う
# x とy について, 全体の2割をテストデータ
として, 残りを訓練データへと切り分けする
X_train, X_test, y_train, y_test =
train_test_split(X_data, y_data,
test_size=0.2, random_state=42)
y_train = y_train.reshape(404,1)
y_test = y_test.reshape(102,1)
#分割したデータの長さを確認する
print(X_train.shape)
print(y_train.shape)
print(X_test.shape)
print(y_test.shape)