def create_split_vertical(folder, input_path='user_item_matrix_vertical.pq', ouput_path='user_item_vertical', cut_dump=10, time_column='ts'):
    '\n    Loads the horizontal user item data from folder and creates a user-wise a 70% train, 20% validation, 10% test split.\n    This means for each user the first 70% read articles are in the train the next 20% in validation and the last 10%\n    read articles in the test set. We remove users with less than 10 clicked articles.\n    This is the data that is loaded to train/test the models in the end.\n    '
    now = datetime.datetime.now()
    user_item = pd.read_parquet(f'{folder}/{input_path}').sort_values(time_column)
    user_item['count'] = user_item.groupby(['user_ix']).article_id.transform('count')
    user_item = user_item[(user_item['count'] > cut_dump)]
    grouped = user_item.groupby(['user_ix'])
    user_item['percentile'] = ((grouped.article_id.cumcount() + 1) / grouped.article_id.transform('count'))
    user_item_train = user_item[(user_item['percentile'] <= 0.7)]
    user_item_test = user_item[((user_item['percentile'] > 0.7) & (user_item['percentile'] < 0.9))]
    user_item_validation = user_item[(user_item['percentile'] > 0.9)]
    user_item_train.to_parquet(f'{folder}/{ouput_path}_train.pq')
    user_item_test.to_parquet(f'{folder}/{ouput_path}_test.pq')
    user_item_validation.to_parquet(f'{folder}/{ouput_path}_validation.pq')
    print(f'Split created {(datetime.datetime.now() - now)}')
Loads the horizontal user item data from folder and creates a user-wise a 70% train, 20% validation, 10% test split.
This means for each user the first 70% read articles are in the train the next 20% in validation and the last 10%
read articles in the test set. We remove users with less than 10 clicked articles.
This is the data that is loaded to train/test the models in the end.
def create_split_vertical(folder, input_path='user_item_matrix_vertical.pq', ouput_path='user_item_vertical', cut_dump=10, time_column='ts'):
    '\n    Loads the horizontal user item data from folder and creates a user-wise a 70% train, 20% validation, 10% test split.\n    This means for each user the first 70% read articles are in the train the next 20% in validation and the last 10%\n    read articles in the test set. We remove users with less than 10 clicked articles.\n    This is the data that is loaded to train/test the models in the end.\n    '
    now = datetime.datetime.now()
    user_item = pd.read_parquet(f'{folder}/{input_path}').sort_values(time_column)
    user_item['count'] = user_item.groupby(['user_ix']).article_id.transform('count')
    user_item = user_item[(user_item['count'] > cut_dump)]
    grouped = user_item.groupby(['user_ix'])
    user_item['percentile'] = ((grouped.article_id.cumcount() + 1) / grouped.article_id.transform('count'))
    user_item_train = user_item[(user_item['percentile'] <= 0.7)]
    user_item_test = user_item[((user_item['percentile'] > 0.7) & (user_item['percentile'] < 0.9))]
    user_item_validation = user_item[(user_item['percentile'] > 0.9)]
    user_item_train.to_parquet(f'{folder}/{ouput_path}_train.pq')
    user_item_test.to_parquet(f'{folder}/{ouput_path}_test.pq')
    user_item_validation.to_parquet(f'{folder}/{ouput_path}_validation.pq')
    print(f'Split created {(datetime.datetime.now() - now)}')