<jupyter_start><jupyter_text>Run in Google Colab         View source on GitHub         Download notebook<jupyter_code># for Collab notebooks, we will start by installing the ``collie`` library
!pip install collie --quiet<jupyter_output><empty_output><jupyter_text>``collie`` ``README`` Quickstart Below is the code snippet found in the [Collie ``README`` Quickstart](https://github.com/ShopRunner/colliequick-start).<jupyter_code>from collie.cross_validation import stratified_split
from collie.interactions import ExplicitInteractions
from collie.metrics import explicit_evaluate_in_batches
from collie.model import MatrixFactorizationModel, CollieTrainer
from collie.movielens import read_movielens_df

from torchmetrics import MeanAbsoluteError, MeanSquaredError


# read in explicit MovieLens 100K data
df = read_movielens_df()

# store data as ``Interactions``
interactions = ExplicitInteractions(users=df['user_id'],
                                    items=df['item_id'],
                                    ratings=df['rating'])

# perform a data split
train, val = stratified_split(interactions)

# train an implicit ``MatrixFactorization`` model
model = MatrixFactorizationModel(train=train,
                                 val=val,
                                 embedding_dim=10,
                                 lr=1e-2,
                                 loss='mse',
                                 optimizer='adam')
trainer = CollieTrainer(model, max_epochs=10)
trainer.fit(model)
model.eval()

# evaluate the model
mae_score, mse_score = explicit_evaluate_in_batches(metric_list=[MeanAbsoluteError(),
                                                                 MeanSquaredError()],
                                                    test_interactions=val,
                                                    model=model)

print(f'MAE: {mae_score}')
print(f'MSE: {mse_score}')<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.08186528497409326, 'fraction_numerical': 0.00466321243523316, 'mean_word_length': 2.3641114982578397, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 14, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '33123', 'license': 'BSD-3-Clause', 'n_tokens_mistral': 522, 'n_tokens_neox': 502, 'n_words': 116, 'path': 'tutorials/quickstart-explicit.ipynb', 'repo_name': 'innerNULL/collie', 'size': '1930'}