def mini_batches_update(X, Y, mini_batch_size=64, seed=0):
    m = X.shape[0]
    mini_batches = list()
    np.random.seed(seed)
    (shuffled_X, shuffled_Y) = (X, Y)
    Y = Y.tolist()
    Y_pos = [i for i in range(len(Y)) if (Y[i] == 1)]
    Y_neg = [i for i in range(len(Y)) if (Y[i] == 0)]
    num_complete_minibatches = (int(math.floor((m / float(mini_batch_size)))) + 1)
    for k in range(0, num_complete_minibatches):
        indexes = sorted((random.sample(Y_pos, int((mini_batch_size / 2))) + random.sample(Y_neg, int((mini_batch_size / 2)))))
        (mini_batch_X, mini_batch_Y) = (shuffled_X[indexes], shuffled_Y[indexes])
        mini_batch = (mini_batch_X, mini_batch_Y)
        mini_batches.append(mini_batch)
    return mini_batches
def mini_batches_update(X, Y, mini_batch_size=64, seed=0):
    m = X.shape[0]
    mini_batches = list()
    np.random.seed(seed)
    (shuffled_X, shuffled_Y) = (X, Y)
    Y = Y.tolist()
    Y_pos = [i for i in range(len(Y)) if (Y[i] == 1)]
    Y_neg = [i for i in range(len(Y)) if (Y[i] == 0)]
    num_complete_minibatches = (int(math.floor((m / float(mini_batch_size)))) + 1)
    for k in range(0, num_complete_minibatches):
        indexes = sorted((random.sample(Y_pos, int((mini_batch_size / 2))) + random.sample(Y_neg, int((mini_batch_size / 2)))))
        (mini_batch_X, mini_batch_Y) = (shuffled_X[indexes], shuffled_Y[indexes])
        mini_batch = (mini_batch_X, mini_batch_Y)
        mini_batches.append(mini_batch)
    return mini_batches