get.factor.matrices: Extract Latent Factor Matrices

get.factor.matricesR Documentation

Extract Latent Factor Matrices


Extract the latent factor matrices for users (rows) and columns (items) from a Poisson factorization model object, as returned by function 'poismf'.


get.factor.matrices(model, add_names = TRUE)



A Poisson factorization model, as produced by 'poismf'.


Whether to add row names to the matrices if the indices were internally remapped - they will only be so if the 'X' passed to 'poismf' was a 'data.frame'. Note that if passing 'X' as 'data.frame' with integer indices to 'poismf', once row names are added, subsetting such matrix by an integer will give the row at that position - that is, if you want to obtain the corresponding row for ID=2 from 'X' in 'factors$A', you need to use 'factors$A["2", ]', not 'factors$A[2, ]'.


If 'X' passed to 'poismf' was a 'data.frame', the mapping between IDs from 'X' to row numbers in 'A' and column numbers in 'B' are avaiable under 'model$levels_A' and 'model$levels_B', respectively. They can also be obtained through 'get.model.mappings', and will be added as row names if using 'add_names=TRUE'. Be careful about subsetting with integers (see documentation for 'add_names' for details).


List with entries 'A' (the user factors) and 'B' (the item factors).

See Also


poismf documentation built on March 18, 2022, 6:19 p.m.