Weighted Regularize Matrix Factorization by alternating least squares.
See: Y. Hu, Y. Koren and C. Volinsky, Collaborative filtering for implicit feedback datasets, ICDM 2008. http://research.yahoo.net/files/HuKorenVolinsky-ICDM08.pdf R. Pan et al., One-class collaborative filtering, ICDM 2008. http://www.hpl.hp.com/techreports/2008/HPL-2008-48R1.pdf
Bases: mrec.mf.recommender.MatrixFactorizationRecommender
Parameters : | d : int
alpha : float
lbda : float
num_iters : int
|
---|
Methods
batch_recommend_items(dataset[, max_items, ...]) | Recommend new items for all users in the training dataset. |
fit(train[, item_features]) | Learn factors from training set. |
init_factors(num_factors[, assign_values]) | |
load(filepath) | Load a recommender model from file after it has been serialized with save(). |
load_factors(user_factor_filepath, ...) | Load precomputed user and item factors from file. |
predict_ratings([users, item_features]) | Predict ratings/scores for all items for supplied users. |
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 up to max_items most highly recommended items for user u. |
save(filepath) | Serialize model to file. |
update(indices, H, HH) | Update latent factors for a single user or item. |
Learn factors from training set. User and item factors are fitted alternately.
Parameters : | train : scipy.sparse.csr_matrix or mrec.sparse.fast_sparse_matrix
item_features : array_like, shape = [num_items, num_features]
|
---|
Update latent factors for a single user or item.
Bases: mrec.mf.recommender.MatrixFactorizationRecommender
Learn matrix factorization optimizing the WARP loss.
Parameters : | d : int
gamma : float
C : float
batch_size : int
positive_thresh: float :
max_trials : int
|
---|
Methods
batch_recommend_items(dataset[, max_items, ...]) | Recommend new items for all users in the training dataset. |
create_validation_set(train) | Hide and return half of the known items for a sample of users, and estimate the number of sgd iterations to run. |
fit(train[, item_features]) | Learn factors from training set. |
load(filepath) | Load a recommender model from file after it has been serialized with save(). |
load_factors(user_factor_filepath, ...) | Load precomputed user and item factors from file. |
predict_ratings([users, item_features]) | Predict ratings/scores for all items for supplied users. |
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 up to max_items most highly recommended items for user u. |
save(filepath) | Serialize model to file. |
Hide and return half of the known items for a sample of users, and estimate the number of sgd iterations to run.
Parameters : | train : scipy.sparse.csr_matrix
|
---|---|
Returns : | max_iters : int
validation_iters : int
validation : dict
|
Learn factors from training set.
Parameters : | train : scipy.sparse.csr_matrix
item_features : array_like, shape = [num_items, num_features]
|
---|
Bases: mrec.mf.warp.WARPMFRecommender
Learn matrix factorization optimizing the WARP loss with item features as well as user-item training data.
Parameters : | d : int
gamma : float
C : float
batch_size : int
positive_thresh: float :
max_trials : int
|
---|
Methods
batch_recommend_items(dataset[, max_items, ...]) | Recommend new items for all users in the training dataset. |
create_validation_set(train) | Hide and return half of the known items for a sample of users, and estimate the number of sgd iterations to run. |
fit(train[, item_features]) | Learn factors from training set and item features. |
load(filepath) | Load a recommender model from file after it has been serialized with save(). |
load_factors(user_factor_filepath, ...) | Load precomputed user and item factors from file. |
predict_ratings([users, item_features]) | Predict ratings/scores for all items for supplied users. |
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 up to max_items most highly recommended items for user u. |
save(filepath) | Serialize model to file. |
Learn factors from training set and item features.
Parameters : | train : scipy.sparse.csr_matrix
item_features : array_like, shape = [num_items, num_features]
|
---|
Predict ratings/scores for all items for supplied users. Assumes you’ve already called fit() to learn the factors.
Only call this if you really want predictions for all items. To get the top-k recommended items for each user you should call one of the recommend_items() instead.
Parameters : | users : int or array-like
item_features : array_like, shape = [num_items, num_features]
|
---|---|
Returns : | predictions : numpy.ndarray, shape = [len(users), num_items]
|