def split_train_val_forwardChaining(sequence, numInputs, numOutputs, numJumps):
    ' Returns sets to train and cross-validate a model using forward chaining technique\n    \n    Parameters:\n        sequence (array)  : Full training dataset\n        numInputs (int)   : Number of inputs X and Xcv used at each training and validation\n        numOutputs (int)  : Number of outputs y and ycv used at each training and validation\n        numJumps (int)    : Number of sequence samples to be ignored between (X,y) sets\n\n    Returns:\n        X (2D array)    : Array of numInputs arrays used for training\n        y (2D array)    : Array of numOutputs arrays used for training\n        Xcv (2D array)  : Array of numInputs arrays used for cross-validation\n        ycv (2D array)  : Array of numOutputs arrays used for cross-validation\n        \n    '
    (X, y, Xcv, ycv) = (dict(), dict(), dict(), dict())
    j = 2
    while 1:
        start_ix = 0
        end_ix = 0
        startCv_ix = 0
        endCv_ix = 0
        (X_it, y_it, Xcv_it, ycv_it) = (list(), list(), list(), list())
        i = 0
        while (i < j):
            start_ix = (numJumps * i)
            end_ix = (start_ix + numInputs)
            seq_x = sequence[start_ix:end_ix]
            X_it.append(seq_x)
            seq_y = sequence[end_ix:(end_ix + numOutputs)]
            y_it.append(seq_y)
            i += 1
        if (((end_ix + numInputs) + numOutputs) > len(sequence)):
            break
        startCv_ix = end_ix
        endCv_ix = (end_ix + numInputs)
        seq_xcv = sequence[startCv_ix:endCv_ix]
        Xcv_it.append(seq_xcv)
        seq_ycv = sequence[endCv_ix:(endCv_ix + numOutputs)]
        ycv_it.append(seq_ycv)
        X[(j - 2)] = np.array(X_it)
        y[(j - 2)] = np.array(y_it)
        Xcv[(j - 2)] = np.array(Xcv_it)
        ycv[(j - 2)] = np.array(ycv_it)
        j += 1
    if ((len(X) == 0) or (len(Xcv) == 0)):
        print('The sequence provided does not has size enough to populate the return arrays')
    return (X, y, Xcv, ycv)
Returns sets to train and cross-validate a model using forward chaining technique

Parameters:
    sequence (array)  : Full training dataset
    numInputs (int)   : Number of inputs X and Xcv used at each training and validation
    numOutputs (int)  : Number of outputs y and ycv used at each training and validation
    numJumps (int)    : Number of sequence samples to be ignored between (X,y) sets

Returns:
    X (2D array)    : Array of numInputs arrays used for training
    y (2D array)    : Array of numOutputs arrays used for training
    Xcv (2D array)  : Array of numInputs arrays used for cross-validation
    ycv (2D array)  : Array of numOutputs arrays used for cross-validation
def split_train_val_forwardChaining(sequence, numInputs, numOutputs, numJumps):
    ' Returns sets to train and cross-validate a model using forward chaining technique\n    \n    Parameters:\n        sequence (array)  : Full training dataset\n        numInputs (int)   : Number of inputs X and Xcv used at each training and validation\n        numOutputs (int)  : Number of outputs y and ycv used at each training and validation\n        numJumps (int)    : Number of sequence samples to be ignored between (X,y) sets\n\n    Returns:\n        X (2D array)    : Array of numInputs arrays used for training\n        y (2D array)    : Array of numOutputs arrays used for training\n        Xcv (2D array)  : Array of numInputs arrays used for cross-validation\n        ycv (2D array)  : Array of numOutputs arrays used for cross-validation\n        \n    '
    (X, y, Xcv, ycv) = (dict(), dict(), dict(), dict())
    j = 2
    while 1:
        start_ix = 0
        end_ix = 0
        startCv_ix = 0
        endCv_ix = 0
        (X_it, y_it, Xcv_it, ycv_it) = (list(), list(), list(), list())
        i = 0
        while (i < j):
            start_ix = (numJumps * i)
            end_ix = (start_ix + numInputs)
            seq_x = sequence[start_ix:end_ix]
            X_it.append(seq_x)
            seq_y = sequence[end_ix:(end_ix + numOutputs)]
            y_it.append(seq_y)
            i += 1
        if (((end_ix + numInputs) + numOutputs) > len(sequence)):
            break
        startCv_ix = end_ix
        endCv_ix = (end_ix + numInputs)
        seq_xcv = sequence[startCv_ix:endCv_ix]
        Xcv_it.append(seq_xcv)
        seq_ycv = sequence[endCv_ix:(endCv_ix + numOutputs)]
        ycv_it.append(seq_ycv)
        X[(j - 2)] = np.array(X_it)
        y[(j - 2)] = np.array(y_it)
        Xcv[(j - 2)] = np.array(Xcv_it)
        ycv[(j - 2)] = np.array(ycv_it)
        j += 1
    if ((len(X) == 0) or (len(Xcv) == 0)):
        print('The sequence provided does not has size enough to populate the return arrays')
    return (X, y, Xcv, ycv)