Train a Sparse Linear Methods (SLIM) item similarity model using various methods for sparse regression.
Efficient Top-N Recommendation by Linear Regression, M. Levy and K. Jack, LSRS workshop at RecSys 2013.
SLIM: Sparse linear methods for top-n recommender systems, X. Ning and G. Karypis, ICDM 2011. http://glaros.dtc.umn.edu/gkhome/fetch/papers/SLIM2011icdm.pdf
Bases: object
Wraps nearest-neighbour feature selection and regression in a single model.
Methods
fit(A, a) |
Bases: mrec.item_similarity.recommender.ItemSimilarityRecommender
Parameters : | l1_reg : float
l2_reg : float
fit_intercept : bool
ignore_negative_weights : bool
num_selected_features : int
model : string
|
---|
Methods
batch_recommend_items(dataset[, max_items, ...]) | Recommend new items for all users in the training dataset. |
compute_similarities(dataset, j) | Compute item similarity weights for item j. |
compute_similarities_from_vec(dataset, a) | Compute item similarity weights for out-of-dataset item vector. |
fit(dataset[, item_features]) | Learn the complete similarity matrix from a user-item matrix. |
get_similar_items(j[, max_similar_items, ...]) | Get the most similar items to a supplied item. |
load(filepath) | Load a recommender model from file after it has been serialized with save(). |
load_similarity_matrix(filepath, num_items) | Load a precomputed similarity matrix from tsv. |
range_recommend_items(dataset, user_start, ...) | Recommend new items for a range of users in the training dataset. |
read_recommender_description(filepath) | Read a recommender model description from file after it has been saved by save(), without loading any additional associated data into memory. |
recommend_items(dataset, u[, max_items, ...]) | Recommend new items for a user. |
save(filepath) | Serialize model to file. |
Compute item similarity weights for item j.
Compute item similarity weights for out-of-dataset item vector.
Brute-force k-nearest neighbour recommenders intended to provide evaluation baselines.
Bases: mrec.item_similarity.knn.KNNRecommender
Similarity between two items is their cosine distance.
Methods
batch_recommend_items(dataset[, max_items, ...]) | Recommend new items for all users in the training dataset. |
compute_all_similarities(A, a) | |
compute_similarities(dataset, j) | |
fit(dataset[, item_features]) | Learn the complete similarity matrix from a user-item matrix. |
get_similar_items(j[, max_similar_items, ...]) | Get the most similar items to a supplied item. |
load(filepath) | Load a recommender model from file after it has been serialized with save(). |
load_similarity_matrix(filepath, num_items) | Load a precomputed similarity matrix from tsv. |
range_recommend_items(dataset, user_start, ...) | Recommend new items for a range of users in the training dataset. |
read_recommender_description(filepath) | Read a recommender model description from file after it has been saved by save(), without loading any additional associated data into memory. |
recommend_items(dataset, u[, max_items, ...]) | Recommend new items for a user. |
save(filepath) | Serialize model to file. |
Bases: mrec.item_similarity.knn.KNNRecommender
Similarity between two items is their dot product (i.e. cooccurrence count if input data is binary).
Methods
batch_recommend_items(dataset[, max_items, ...]) | Recommend new items for all users in the training dataset. |
compute_all_similarities(A, a) | |
compute_similarities(dataset, j) | |
fit(dataset[, item_features]) | Learn the complete similarity matrix from a user-item matrix. |
get_similar_items(j[, max_similar_items, ...]) | Get the most similar items to a supplied item. |
load(filepath) | Load a recommender model from file after it has been serialized with save(). |
load_similarity_matrix(filepath, num_items) | Load a precomputed similarity matrix from tsv. |
range_recommend_items(dataset, user_start, ...) | Recommend new items for a range of users in the training dataset. |
read_recommender_description(filepath) | Read a recommender model description from file after it has been saved by save(), without loading any additional associated data into memory. |
recommend_items(dataset, u[, max_items, ...]) | Recommend new items for a user. |
save(filepath) | Serialize model to file. |
Bases: mrec.item_similarity.recommender.ItemSimilarityRecommender
Abstract base class for k-nn recommenders. You must supply an implementation of the compute_all_similarities() method.
Parameters : | k : int
|
---|
Methods
batch_recommend_items(dataset[, max_items, ...]) | Recommend new items for all users in the training dataset. |
compute_all_similarities(A, a) | Compute similarity scores between item vector a |
compute_similarities(dataset, j) | |
fit(dataset[, item_features]) | Learn the complete similarity matrix from a user-item matrix. |
get_similar_items(j[, max_similar_items, ...]) | Get the most similar items to a supplied item. |
load(filepath) | Load a recommender model from file after it has been serialized with save(). |
load_similarity_matrix(filepath, num_items) | Load a precomputed similarity matrix from tsv. |
range_recommend_items(dataset, user_start, ...) | Recommend new items for a range of users in the training dataset. |
read_recommender_description(filepath) | Read a recommender model description from file after it has been saved by save(), without loading any additional associated data into memory. |
recommend_items(dataset, u[, max_items, ...]) | Recommend new items for a user. |
save(filepath) | Serialize model to file. |
Compute similarity scores between item vector a and all the rows of A.
Parameters : | A : scipy.sparse.csr_matrix
a : array_like
|
---|---|
Returns : | similarities : numpy.ndarray
|
Make recommendations from a precomputed item similarity matrix.
Bases: mrec.item_similarity.recommender.ItemSimilarityRecommender
Wrapper class to make recommendations using a precomputed item similarity matrix.
Parameters : | description : str
similarity_matrix : array_like(num_items,num_items)
|
---|
Methods
batch_recommend_items(dataset[, max_items, ...]) | Recommend new items for all users in the training dataset. |
compute_similarities(j) | |
fit(dataset[, item_features]) | |
get_similar_items(j[, max_similar_items, ...]) | Get the most similar items to a supplied item. |
load(filepath) | Load a recommender model from file after it has been serialized with save(). |
load_similarity_matrix(filepath, num_items) | Load a precomputed similarity matrix from tsv. |
range_recommend_items(dataset, user_start, ...) | Recommend new items for a range of users in the training dataset. |
read_recommender_description(filepath) | Read a recommender model description from file after it has been saved by save(), without loading any additional associated data into memory. |
recommend_items(dataset, u[, max_items, ...]) | Recommend new items for a user. |
save(filepath) | Serialize model to file. |
set_similarity_matrix(similarity_matrix) |
Base class for item similarity recommenders.
Bases: mrec.base_recommender.BaseRecommender
Abstract base class for recommenders that generate recommendations from an item similarity matrix. To implement a recommender you just need to supply the compute_similarities() method.
Methods
batch_recommend_items(dataset[, max_items, ...]) | Recommend new items for all users in the training dataset. |
compute_similarities(dataset, j) | Compute pairwise similarity scores between the j-th item and every item in the dataset. |
fit(dataset[, item_features]) | Learn the complete similarity matrix from a user-item matrix. |
get_similar_items(j[, max_similar_items, ...]) | Get the most similar items to a supplied item. |
load(filepath) | Load a recommender model from file after it has been serialized with save(). |
load_similarity_matrix(filepath, num_items) | Load a precomputed similarity matrix from tsv. |
range_recommend_items(dataset, user_start, ...) | Recommend new items for a range of users in the training dataset. |
read_recommender_description(filepath) | Read a recommender model description from file after it has been saved by save(), without loading any additional associated data into memory. |
recommend_items(dataset, u[, max_items, ...]) | Recommend new items for a user. |
save(filepath) | Serialize model to file. |
Recommend new items for all users in the training dataset. Assumes you’ve already called fit() to learn the similarity matrix.
Parameters : | dataset : scipy.sparse.csr_matrix
max_items : int
return_scores : bool
show_progress: bool :
item_features : array_like, shape = [num_items, num_features]
|
---|---|
Returns : | recs : list of lists
|
Compute pairwise similarity scores between the j-th item and every item in the dataset.
Parameters : | j : int
dataset : mrec.sparse.fast_sparse_matrix
|
---|---|
Returns : | similarities : numpy.ndarray
|
Learn the complete similarity matrix from a user-item matrix.
Parameters : | dataset : scipy sparse matrix or mrec.sparse.fast_sparse_matrix, shape = [num_users, num_items]
item_features : array_like, shape = [num_items, num_features]
|
---|
Get the most similar items to a supplied item.
Parameters : | j : int
max_similar_items : int
dataset : mrec.sparse.fast_sparse_matrix
|
---|---|
Returns : | sims : list
|
Load a precomputed similarity matrix from tsv.
Parameters : | filepath : str
num_items : int
offset : int
|
---|
Recommend new items for a range of users in the training dataset. Assumes you’ve already called fit() to learn the similarity matrix.
Parameters : | dataset : scipy.sparse.csr_matrix
user_start : int
user_end : int
max_items : int
return_scores : bool
item_features : array_like, shape = [num_items, num_features]
|
---|---|
Returns : | recs : list of lists
|
Recommend new items for a user. Assumes you’ve already called fit() to learn the similarity matrix.
Parameters : | dataset : scipy.sparse.csr_matrix
u : int
max_items : int
return_scores : bool
item_features : array_like, shape = [num_items, num_features]
|
---|---|
Returns : | recs : list
|