def make_folds(y, cfg, verbose=False):
    """Constructs the folds from crossval configuration

    Parameters
    ----------
    y : array, shape (n_samples, n_targets)
        targets array
    cfg : dict,
        configuration dict for cross-validation.
    verbose : boolean, optional
        verbose mode
    """
    folds = []
    keys = []
    if cfg["stratified"] and 1 > y.ndim:
        raise TypeError("Stratified and multi-target are incompatible.")
    else:
        # construct the outer cross-validation folds iterator
        fg = _construct_folds_iterator(y, cfg, "crossval_score")
        for i, (train, test) in enumerate(fg):
            if verbose:
                print("Outer Fold {}:\n{}\n{}\n---".format(
                        i, np.sort(y[train]), np.sort(y[test])))
            folds.append((train, test))
            keys.append("%d" % i)
            if cfg["modelSelection"]:
                yi = y[train]
                # construct the inner cross-validation folds iterator
                fgi = _construct_folds_iterator(yi, cfg, "gridSearch")
                for k, (itrain, itest) in enumerate(fgi):
                    if verbose:
                        print("Inner Fold {}:\n{}\n{}\n---".format(
                                k, np.sort(yi[itrain]), np.sort(yi[itest])))
                    folds.append((itrain, itest))
                    keys.append("%d_%d" % (i, k))
    # associate string identifiers with corresponding folds
    if cfg["modelSelection"]:
        folds_dic = dict(zip(keys, folds), n_inner=(k + 1), n_outer=(i + 1))
    else:
        folds_dic = dict(zip(keys, folds), n_outer=(i + 1))
    return folds_dic
dataset/ETHPy150Open BenoitDamota/mempamal/mempamal/crossval.py/make_folds/swapped operands of `>`