train_test_split을 사용하면 TypeError가 뜹니다.

조회수 650회

저장되어 있는 hdf5 파일을 HDF5Matrix로 불러와 트레이닝 데이터와 테스트 데이터로 나누려고 하면

import numpy as np
import tensorflow as tf
from keras.utils.io_utils import HDF5Matrix
from sklearn.model_selection import train_test_split

filename = "./data.hdf5"
dataname, labelname = "data", "label"

X = HDF5Matrix(filename, dataname)
y = HDF5Matrix(filename, labelname)

seed = 1
np.random.seed(seed)
tf.set_random_seed(seed)
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=seed)

다음과 같은 에러가 뜨네요.

  /python3.6/site-packages/h5py/_hl/selections.py", line 85, in select int(a)
TypeError: int() argument must be a string, a bytes-like object or a number, not 'list'

....

/python3.6/site-packages/h5py/_hl/selections.py", line 367, in __getitem__raise
TypeError("Indexing elements must be in increasing order")

X.shape(800, 62, 64, 64), y.shape(800,)입니다.
그리고 둘 다 dtype='u1'으로 저장되어 있는 상태입니다.

어디에서 에러가 생겼는지 감이 안 잡히네요.

  • (•́ ✖ •̀)
    알 수 없는 사용자

답변을 하려면 로그인이 필요합니다.

프로그래머스 커뮤니티는 개발자들을 위한 Q&A 서비스입니다. 로그인해야 답변을 작성하실 수 있습니다.

(ಠ_ಠ)
(ಠ‿ಠ)