get.factor.matrices: Extract Latent Factor Matrices

get.factor.matricesR Documentation

Extract Latent Factor Matrices

Description

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

Usage

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

Arguments

model

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

add_names

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, ]'.

Details

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).

Value

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

See Also

get.model.mappings


poismf documentation built on March 31, 2023, 7:38 p.m.