Latent factors number
I have noticed that the latent vector returned by the BPR model has one more factor than the one given in the 'factors' parameters. e.g. When I choose 200, I get 201 factors. Moreover, this factor is always 1 for the user vectors. Could you please explain that? Thanks in advance!
It is bias for an item.
Thanks! I have two additional questions:
- why there is no user bias?
- do you think it's right to include the item bias in the cosine similarity when calculating similar items?
-
I can't explain it easily... see the paper https://arxiv.org/pdf/1205.2618.pdf BPR model cannot exploit user bias from its assumption (see the paper)
-
In my opinion, no but you can experiment whether it is good for your purpose or not to include item bias.
Thank you!
I just ran some experiments with and without including the item bias term - and found that it makes basically no difference. I know that including bias terms for explicit models led to some big wins, but I don't think they matter for implicit models. I may remove this at some point, it does complicate things slightly ...
For the user bias, I mainly left out because I was slightly ambivalent about including bias terms at all - and the rationale for including a user bias term is even weaker than the item bias imho (ie, the learned user bias will never affect ranking for a user since it will just add a constant etc).
I know of other implementations that include a user bias term for bpr (lightfm) and others that just include an item bias term with no user bias like here (gamboviol/bpr) and others that don't include any bias terms at all (librec and lenskit ). IIRC, the original paper doesn't mentions bias terms at all.
@benfred To my knowledge, including user bias in BPR model is meaningless for two reasons.
-
You mentioned that the user bias have no effects on ranking items w.r.t the user.
-
In the objective in the BPR model,
x_uijis defined asf(v_u,v_i) - f(v_u,v_j)(v_u, v_iare a latent factor for user u and item i andf(x, y)is normally dot product of x and y.) BPR can be extended to have item bias usingf(v_u,v_i) = dot(v_u,v_i) + b_i(b_iis bias for the item i) However, it is not possible to include user bias in this way because user bias term is removed in the x_uij term.
x_uij = f(v_u, v_i) - f(v_u, v_j) = dot(v_u, v_i) + b_u - [dot(v_u, v_i) + b_u] =
dot(v_u, v_i) - dot(v_u, v_j) // no user bias term.
How to include user bias in BPR model?...
There is another implementation of BPR model that includes only item biases qmf
Thanks in advance.
Thanks for your answers! I understand both reasons for not having a user bias. However, I use the trained model to perform recommendations in both directions: (i) recommend items to users and (ii) recommend users to items. Do you think the training method could also be performed in both directions at the same time? i.e. apart from sampling pairs of f(v_u,v_i) - f(v_u,v_j) one could also sample pairs of f(v_u,v_i) - f(v_j,v_i). In this case a user bias could be possible.
Regarding the negligible effect of the current item bias to the performance, maybe this is a result of binarizing the interactions (which I think is currently performed for the bpr model).