Description Usage Arguments Value See Also
Calculate the predicted values for new columns of 'X' (which were not present in the 'X' to which the model was fit) given new 'X' and/or 'I' data.
This function can predict combinations in 3 ways:
If passing vectors for 'user' and 'item', will predict the combinations of user/item given in those arrays (e.g. if 'I' has 3 rows, and passing 'user=c(1,1,2), item=c(1,2,3)', will predict entries X[1,1], X[1,2], X[2,3], with columns of 'X' (rows of 't(X)') corresponding to the rows of 'I' passed here and users corresponding to the ones to which the model was fit).
If passing a vector for 'user' but not for 'item', will predict the value that each user would give to the corresponding row of 'I'/'t(X)' (in this case, the number of entries in 'user' should be the same as the number of rows in 'I'/'t(X)').
If passing a single value for 'user', will calculate all predictions for that user for the rows of 'I'/'t(X)' given in 'item', or for all rows of 'I'/'t(X)' if 'item' is not given.
Be aware that the package is user/row centric, and this function is provided for quick experimentation purposes only. Calculating item factors will be slower than calculating user factors as it will not make usage of the precomputed matrices (except for the 'ContentBased' model for which both types of predictions are equally fast and equally supported). If itembased predictions are required, it's recommended to use instead the function swap.users.and.items and then use the resulting object with predict_new.
1 2 3 4 5 6 7 8 9 
model 
A collective matrix factorization model from this package  see fit_models for details. 
user 
User(s) for which the new entries will be predicted. If passing a single ID, will calculate all the values in 'item', or all the values in 'I'/'t(X)' (see section 'Description' for details). If the 'X' to which the model was fit was a 'data.frame', the IDs here should match with the IDs of that 'X' (its first column). Otherwise, should match with the rows of 'X' (the one to which the model was fit) with numeration starting at 1 (should be an integer vector). 
item 
Rows of 'I'/'transX' (unseen columns of a new 'X') for which to make predictions, with numeration starting at 1 (should be an integer vector). See 'Description' for details. 
transX 
New 'X' data for the items, transposed so that items denote rows and columns correspond to old users (which were in the 'X' to which the model was fit). Note that the function will not do any reindexing  if the 'X' to which the model was fit was a 'data.frame', the user numeration can be found under 'model$info$user_mapping'. Can be passed in the following formats:

weight 
Associated observation weights for entries in 'transX'. If passed, must have the same shape as 'transX'  that is, if 'transX' is a sparse matrix, should be a numeric vector with length equal to the nonmissing elements, if 'transX' is a dense matrix, should also be a dense matrix with the same number of rows and columns. 
I 
New 'I' data, with rows denoting new columns of the 'X' matrix (the one to which the model was fit) and/or rows of 'transX'. Can be passed in the same formats as 'transX', or additionally as a 'data.frame'. 
I_bin 
New binary columns of 'I'. Must be passed as a dense matrix from base R or as a 'data.frame'. 
A numeric vector with the predicted value for each requested combination of (user, item). Invalid combinations will be filled with NAs.
item_factors predict.cmfrec predict_new
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.