factors.single {poismf} | R Documentation |
Get latent factors for a new user given her item counts
Description
This is similar to obtaining topics for a document in LDA. See also function factors for getting factors for multiple users/rows at a time.
This function works with one user at a time, and will use the TNCG solver regardless of how the model was fit. Note that, since this optimization method may have different optimal hyperparameters than the other methods, it offers the option of varying those hyperparameters in here.
Usage
factors.single(
model,
X,
l2_reg = model$l2_reg,
l1_reg = model$l1_reg,
weight_mult = model$weight_mult,
maxupd = max(1000L, model$maxupd)
)
Arguments
model |
Poisson factorization model as returned by 'poismf'. |
X |
Data with the non-zero item indices and counts for this new user. Can be passed as a sparse vector from package 'Matrix' ('Matrix::dsparseVector', which can be created from indices and values through function 'Matrix::sparseVector'), or as a 'data.frame', in which case will take the first column as the item/column indices (numeration starting at 1) and the second column as the counts. If 'X' passed to 'poismf' was a 'data.frame', 'X' here must also be a 'data.frame'. |
l2_reg |
Strength of L2 regularization to use for optimizing the new factors. |
l1_reg |
Strength of the L1 regularization. Not recommended. |
weight_mult |
Weight multiplier for the positive entries over the missing entries. |
maxupd |
Maximum number of TNCG updates to perform. You might want to increase this value depending on the use-case. |
Details
The factors are initialized to the mean of each column in the fitted model.
Value
Vector of dimensionality 'model$k' with the latent factors for the user, given the input data.