train_test_split을 사용하면 TypeError가 뜹니다.
조회수 657회
저장되어 있는 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'
으로 저장되어 있는 상태입니다.
어디에서 에러가 생겼는지 감이 안 잡히네요.
-
(•́ ✖ •̀)
알 수 없는 사용자
댓글 입력