Components
Basic Concepts
Columns
Names of columns are fixed. They are user_id, item_id, weight (numerical value of interaction’s importance), datetime (date and time of interaction), rank (rank of recommendation according to score) and score (numeric value estimating how good recommendation it is). Column names are fixed in order to not constantly require mapping of columns in data and their actual meaning. So you’ll need to rename your columns.
|
Fixed column names for tables that contain interactions and recommendations. |
Identifiers
Mappings of external identifiers of users or items to internal ones.
Recommendation systems always require to have a mapping between external item ids in data sources
and internal ids in interaction matrix. Managing such mapping requires a lot of diligence. RecTools does it for you.
Every user and item must have a unique id.
External ids may be any unique hashable values, internal - always integers from 0 to n_objects-1.
Interactions
This table stores history of interactions between users and items. It carries the most importance. Interactions table might also contain column describing importance of an interaction. Also timestamp of interaction. If no such column is provided, all interactions are assumed to be of equal importance.
User Features
This table stores data about users. It might include age, gender or any other features which may prove to be important for a recommender model.
Item Features
This table stores data about items. It might include category, price or any other features which may prove to be important for a recommender model.
All of the above concepts are combined in Dataset. Dataset is used to build recommendation models and infer recommendations.
Dataset
Details of RecTools Dataset
See the API documentation for further details on Dataset:
|
Container class for all data for a recommendation model. |
Storage for dense features. |
|
|
Mapping between external and internal object ids. |
Structure to storage info about user-item interactions. |
|
Storage for sparse features. |
Recommendation Table
Recommendation table contains recommendations for each user. It has a fixed set of columns, though they are different for i2i and u2i recommendations. Recommendation table can also be used for calculation of metrics.
Models
Details of RecTools Models
See the API documentation for further details on Models:
|
Wrapper for rectools.models.dssm.DSSM |
Wrapper for implicit.als.AlternatingLeastSquares with possibility to use explicit features and GPU support. |
|
|
Wrapper for implicit.nearest_neighbours.ItemItemRecommender and its successors. |
Wrapper for lightfm.LightFM. |
|
|
Model generating recommendations based on popularity of items. |
Model generating recommendations based on popularity of items. |
|
PureSVD matrix factorization model. |
|
Model generating random recommendations. |
What are you waiting for? Train and apply them!
Metrics
Details of RecTools Metrics
See the API documentation for further details on Dataset:
Ratio of correctly recommended items among all items. |
|
Intra-List Diversity metric. |
|
|
Mean Average Precision at k (MAP@k). |
Mean Inverse User Frequency metric. |
|
|
Normalized Discounted Cumulative Gain at k (NDCG@k). |
Base pairwise distance calculator class |
|
|
Class for computing Hamming distance between a pair of items. |
Ratio of relevant items among top-k recommended items. |
|
Ratio of relevant recommended items among all items user interacted with after recommendations were made. |
|
Serendipity metric. |
|
|
Class for computing Hamming distance between multiple pairs of elements represented in features matrix in sparse form. |
|
Calculate metrics. |
Oops, yeah, can’t forget about them.
Model selection
Details of RecTools Model selection
See the API documentation for further details on Model selection:
Splitter for cross-validation by time. |
Tools
Details of RecTools Tools
See the API documentation for further details on Tools:
Class implements item-to-item ANN recommender. |
|
Class implements user to item ANN recommender. |