def data_iterator(train_x, train_y, batch_size = 256):
    '''
    Generate batches of training data for training (for single epoch)
    Inputs:
        train_df (pd.DataFrame) : complete training data
        batch_size (int) : Size of each batch
    Returns:
        text_arr (np.matrix) : Matrix of shape (batch_size,embed_size)
        lebel_arr (np.array) : Labels of this batch. Array of shape (batch_size,)
    '''
    n_batches = math.ceil(len(train_x) / batch_size)
    for idx in range(n_batches):
        x = train_x[idx *batch_size:(idx+1) * batch_size]
        y = train_y[idx *batch_size:(idx+1) * batch_size]
        yield x, y

    Generate batches of training data for training (for single epoch)
    Inputs:
        train_df (pd.DataFrame) : complete training data
        batch_size (int) : Size of each batch
    Returns:
        text_arr (np.matrix) : Matrix of shape (batch_size,embed_size)
        lebel_arr (np.array) : Labels of this batch. Array of shape (batch_size,)
    
Model_fastText/old_code/utils.py