def split_to_chunks(x, y, max_chunk_size, overlapping_size):
    """
    We split input data into `max_training_size` chunks with each chunk overlapping `overlapping_size` points
    with the previous and next chunks.
    :param x: unscaled feature matrix of size n x 1
    :param y: unscaled label matrix of size n x 2
    :param max_chunk_size: the max size of each chunks
    :param overlapping_size: the #points overlapping between each consecutive chunks
    :return: list of tuples where each tuple contains (x_i, y_i) of i-th chunk
    """
    chunks = list()

    n = len(x)
    i = 0
    while True:
        next_i = min(i + max_chunk_size, n)
        chunks.append((x[i:next_i], y[i:next_i]))
        if n <= next_i:
            break
        i = next_i - overlapping_size

    return chunks