predict.poismf {poismf} | R Documentation |
Predict expected count for new row(user) and column(item) combinations
Description
Predict expected count for new row(user) and column(item) combinations
Usage
## S3 method for class 'poismf'
predict(object, a, b = NULL, nthreads = parallel::detectCores(), ...)
Arguments
object |
A Poisson factorization model as returned by 'poismf'. |
a |
Can be either:
|
b |
A vector of length N with the items/columns to predict - each entry will be matched to the corresponding entry at the same position in 'a' - e.g. to predict value for entries (3,4), (3,5), and (3,6), should pass 'a=c(3,3,3), b=c(3,5,6)'. If 'X' passed to 'poismf' was a 'data.frame', should match with the entries in its second column. If 'X' passed to 'poismf' was a matrix, should indicate the column numbers (numeration starting at 1). If 'a' is a sparse matrix, should not pass 'b'. |
nthreads |
Number of parallel threads to use. |
... |
Not used. |
Value
If 'a' and 'b' were passed, will return a vector of length N with the predictions for the requested row/column combinations.
If 'b' was not passed, will return a sparse matrix with the same entries and shape as 'a', but with the values being the predictions from the model for the non-missing entries. In such case, the output will be of class 'Matrix::dgTMatrix'.