

def split(self, train_ratio, valid_ratio):
    n = _get_n(self._input)
    n_train = int((n * train_ratio))
    n_valid = int((n * valid_ratio))
    p = nprng.permutation(n)
    self._train_ind = p[0:n_train]
    self._valid_ind = p[n_train:(n_train + n_valid)]
    self._test_ind = p[(n_train + n_valid):]
    if isinstance(self._input, list):
        self._train.input = [HierarData(X[self._train_ind], limit=self._limit) for X in self._input]
        self._valid.input = [HierarData(X[self._valid_ind], limit=self._limit) for X in self._input]
        self._test.input = [HierarData(X[self._test_ind], limit=self._limit) for X in self._input]
    else:
        self._train.input = HierarData(self._input[self._train_ind], limit=self._limit)
        self._valid.input = HierarData(self._input[self._valid_ind], limit=self._limit)
        self._test.input = HierarData(self._input[self._test_ind], limit=self._limit)
    if isinstance(self._target, list):
        self._train.target = [HierarData(Y[self._train_ind], limit=self._limit) for Y in self._target]
        self._valid.target = [HierarData(Y[self._valid_ind], limit=self._limit) for Y in self._target]
        self._test.target = [HierarData(Y[self._test_ind], limit=self._limit) for Y in self._target]
    else:
        self._train.target = HierarData(self._target[self._train_ind], limit=self._limit)
        self._valid.target = HierarData(self._target[self._valid_ind], limit=self._limit)
        self._test.target = HierarData(self._target[self._test_ind], limit=self._limit)

dataset/ETHPy150Open Cysu/dlearn/dlearn/data/dataset.py Dataset.split/original