I have a sparse matrix sparse
with 1100 columns corresponding to products and over 130k rows corresponding to users. The values are 1 or NA in this sparse matrix where 1 corresponds to a 'purchase' and NA to 'no purchase'.
I converted this matrix into a realRatingMatrix
and tried to build an IBCF model in this way:
item_rec <- Recommender(sparse[1:nrow(sparse)],method="IBCF",
param=list(method="Cosine",k=30, normalize_sim_matrix = F,
alpha = 0.5, na_as_zero = F))
This command has been running for several hours now while another model with UBCF
method was completed in seconds:
rec <- Recommender(sparse[1:nrow(sparse)],method="UBCF",
param=list(method="Cosine",nn=5, minRating=1))
While the item-item similarity matrix may take more time to construct, is it normal for it to take this much time or am I doing something wrong with the code or my approach (like, should I convert it into a binaryRatingMatrix
or use different arguments?)
Cosine distance is for now calculated on a dense matrix (a sparse implementation will hopefully be added someday). I think creating the full matrix and then calculating the distance takes so long.
Have you tries a smaller sample? Maybe 1000 or 10000 rows?