<jupyter_start><jupyter_text>Installation<jupyter_code>!pip install -q pytorch-lightning
!pip install -q -U git+https://github.com/RecoHut-Projects/recohut.git@v0.0.11.post4
!apt-get -qq install tree<jupyter_output><empty_output><jupyter_text>ML1m Dataset<jupyter_code>from recohut.datasets.movielens import ML1mDataset_v4
ds = ML1mDataset_v4(data_dir='/content/data')
data = ds.load()
x_train = data["x_train"]
y_train = None
x_test = data["x_test"]
y_test = data["y_test"]<jupyter_output><empty_output><jupyter_text>Prod2vec Model<jupyter_code>from recohut.models.prod2vec import Prod2Vec_v2
model = Prod2Vec_v2()
model.train(x_train)
y_pred = model.predict(x_test)<jupyter_output>2022-01-13 16:56:58,200 - INFO - collecting all words and their counts
2022-01-13 16:56:58,203 - INFO - PROGRESS: at sentence #0, processed 0 words, keeping 0 word types
2022-01-13 16:56:58,335 - INFO - collected 16411 word types from a corpus of 700103 raw words and 6040 sentences
2022-01-13 16:56:58,337 - INFO - Loading a fresh vocabulary
2022-01-13 16:56:58,374 - INFO - effective_min_count=3 retains 13804 unique words (84% of original 16411, drops 2607)
2022-01-13 16:56:58,375 - INFO - effective_min_count=3 leaves 696422 word corpus (99% of original 700103, drops 3681)
2022-01-13 16:56:58,422 - INFO - deleting the raw counts dictionary of 16411 items
2022-01-13 16:56:58,424 - INFO - sample=0.001 downsamples 0 most-common words
2022-01-13 16:56:58,430 - INFO - downsampling leaves estimated 696422 word corpus (100.0% of prior 696422)
2022-01-13 16:56:58,490 - INFO - estimated required memory for 13804 words and 48 dimensions: 12202736 bytes
2022-01-13 16:56:58,491 - INFO - resetting l[...]<jupyter_text>Behavioral Testing<jupyter_code>from recohut.evaluation.behavioral import *
rec_list = SimilarItemEvaluation(
    x_train=x_train,
    y_train=y_train,
    x_test=x_test,
    y_test=y_test,
    y_preds=y_pred,
)

# invoke rec_list to run tests
rec_list(verbose=True)
!tree -h --du -C ./SimilarItemEvaluation
rec_list = ComplementaryItemEvaluation(
    x_train=x_train,
    y_train=y_train,
    x_test=x_test,
    y_test=y_test,
    y_preds=y_pred,
    model=model
)

# invoke rec_list to run tests
rec_list(verbose=True)
!tree -h --du -C ./ComplementaryItemEvaluation
rec_list = SessionItemEvaluation(
    x_train=x_train,
    y_train=y_train,
    x_test=x_test,
    y_test=y_test,
    y_preds=y_pred,
    model=model
)

# invoke rec_list to run tests
rec_list(verbose=True)
!tree -h --du -C ./SessionItemEvaluation<jupyter_output>[01;34m./SessionItemEvaluation[00m
└── [ 13M]  [01;34m1642093044012[00m
    ├── [ 13M]  [01;34martifacts[00m
    │   └── [ 13M]  model_predictions.json
    ├── [4.0K]  [01;34mplots[00m
    └── [4.9K]  [01;34mresults[00m
        └── [ 878]  report.json

  13M used in 4 directories, 2 files
{'fraction_non_alphanumeric': 0.1193502824858757, 'fraction_numerical': 0.12641242937853106, 'mean_word_length': 4.677354709418838, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '438401', 'license': 'Apache-2.0', 'n_tokens_mistral': 1349, 'n_tokens_neox': 1108, 'n_words': 248, 'path': '_docs/nbs/tutorial-on-behavioral-evaluation-of-recommender-systems.ipynb', 'repo_name': 'sparsh-ai/recohut', 'size': '2832'}