I don't really understand index operations, can you explain what this line doing:
train = data[ranks>=test_points]
in this function
def random_split(data,test_points):
ranks = np.arange(data.shape[0])
np.random.shuffle(ranks)
train = data[ranks>=test_points]
return train
So I need to split data like this: half the points for training, one quarter for validation and one quarter for test. So I did it like this:
def random_split(data,test_points):
ranks = np.arange(data.shape[0])
np.random.shuffle(ranks)
train = data[ranks>=test_points]
other = data[ranks<test_points]
test = other[ranks>=int(test_points/4)]
valid = other[ranks<int(test_points/4)]
return train,test,valid
It doesn't work, what is wrong? Can you help me to understand this code?