deepr.examples.movielens.jobs package
Submodules
deepr.examples.movielens.jobs.build_records module
Build MovieLens dataset as TFRecords.
- class deepr.examples.movielens.jobs.build_records.BuildRecords(path_ratings, path_mapping, path_train, path_eval, path_test, min_rating=4, min_length=5, num_negatives=8, target_ratio=0.2, size_test=10000, size_eval=10000, shuffle_timelines=True, seed=2020)[source]
Bases:
Job
Build MovieLens dataset as TFRecords.
It aggregates movie ratings by user and build timelines of movies. The users are split into train / validation / test sets. Each timeline is split in two sub-timelines: one input, one target. For each item in the target, n negatives are sampled.
The resulting tfrecords have the following fields - “uid”: () - “inputPositives”: [size_input] - “targetPositives”: [size_target] - “targetNegatives”: [size_target, num_negatives]
- deepr.examples.movielens.jobs.build_records.get_timelines(path_ratings, min_rating, min_length)[source]
Build timelines from MovieLens Dataset.
- Apply the following filters
keep movies with ratings > min_rating keep users with number of movies > min_length
deepr.examples.movielens.jobs.evaluate module
Evaluate MovieLens.
- class deepr.examples.movielens.jobs.evaluate.Evaluate(path_predictions, path_embeddings, path_biases=None, k=50, use_mlflow=False, num_queries=1000)[source]
Bases:
Job
Evaluate MovieLens using a Faiss Index.
For each user embedding, the top num_queries items are retrieved. The input items are removed from the results, then we compare the remaining top-K results to the target items.
- deepr.examples.movielens.jobs.evaluate.compute_metrics(inputs, targets, predictions, k)[source]
Compute Recall, Precision and F1.
deepr.examples.movielens.jobs.init module
Init Checkpoint with SVD embeddings.
deepr.examples.movielens.jobs.predict module
Compute MovieLens predictions.
deepr.examples.movielens.jobs.svd module
Build MovieLens dataset as TFRecords.
- class deepr.examples.movielens.jobs.svd.SVD(path_csv, path_embeddings, path_counts, vocab_size, dim=600, min_count=10)[source]
Bases:
Job
Build SVD embeddings.