def split_dataset(dataset, proportions):
    """ Split a dataset into many smaller datasets.

    Parameters
    ----------
    dataset : Dataset
    proportions : [numbers]
        A list of numbers giving the proportions of the dataset to be included in each
        sub-datasets. The proportions are computed according to the sum all the numbers.

    Returns
    -------
    [Datasets]
        A list of datasets which respect the given `proportions`.

    """
    from .interfaces.dataset import Dataset
    indices = np.cumsum(np.ceil(np.sum(proportions) * len(dataset) / np.array(proportions)))
    indices[-1] = len(dataset)
    dsets = []

    for s, f in zip([0] + list(indices), indices):
        s, f = int(s), int(f)

        covars = dataset.inputs.get_value()[s:f]
        targets = dataset.targets.get_value()[s:f] if dataset.has_targets else None

        dset = Dataset(covars, targets, dataset.name + '_' + str(s) + 'to' + str(f))
        dset.symb_inputs = dataset.symb_inputs
        dset.symb_targets = dataset.symb_targets

        dsets.append(dset)

    return dsets
dataset/ETHPy150Open SMART-Lab/smartlearner/smartlearner/utils.py/split_dataset/swapped operands of `/`