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:

  • A vector of length N with the users/rows to predict - each entry will be matched to the corresponding entry at the same position in 'b' - 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 first column. If 'X' passed to 'poismf' was a matrix, should indicate the row numbers (numeration starting at 1).

  • A sparse matrix, ideally in COO (triplets) format from package 'Matrix' ('Matrix::dgTMatrix') or from package 'SparseM' ('matrix.coo'), in which case it will make predictions for the non-zero entries in the matrix and will output another sparse matrix with the predicted entries as values. In this case, 'b' should not be passed. This option is not available if the 'X' passed to 'poismf' was a 'data.frame'.

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

See Also

poismf topN factors


[Package poismf version 0.4.0-4 Index]