I used np.random.choice(datasize, n_train_data) to shuffle dataset and split. As to test dataset:
np.random.seed(99)
dataset_index = np.arange(datasize)
train_index_arr = np.random.choice(dataset_index, n_train_data)
mask = ~np.isin(dataset_index, train_index_arr))
val_index_arr = dataset_index[mask]
However it return wrong result. Please kindly refer to the code below:
idx = np.random.choice(range(1000), 300)
sum(~np.isin(np.arange(1000), idx))
>> 742 # expected result: 700
What am I doing wrong?