def make_batches(data, batch_size=100):
    """
    Split the data into minibatches of size batch_size
    
    This procedure generates subsamples ids for batches by only considering 
    features that are active in the minibatch
    
    Args:
        data - the data to be split into minibatches (must be rank 2)
        batch_size - the size of the minibatches 
        
    Returns:
        batches - a list: [(batch, subsample_ids) for batch in minibatchs]
    """
    n = data.shape[0]
    perm = random.permutation(range(n))
    i = 0
    batches = []
    while i < n:
        batch = perm[i:i+batch_size]
        i += batch_size
        batches.append(data[batch])
    try:
        ids = [find((b.sum(0) != 0).A.flatten()) for b in batches]
    except __HOLE__:
        ids = [find((b.sum(0) != 0).flatten()) for b in batches]
    batches = [(b[:,i].toarray(), i) for b,i in zip(batches, ids)]
    return batches
dataset/ETHPy150Open theusual/kaggle-seeclickfix-ensemble/Miroslaw/sparserbm.py/make_batches