LightFM model: scores and sigmoid function inside

356 Views Asked by At

I have two questions related to the LightFM model:

  1. I read the article about the model and I see that it uses sigmoid f(.)-function. I also checked library's Cython code and I see that the function is implemented there as well. However, the model is applicable to rank items in the rating setting (rating from 1 to 5). Why isn't sigmoid harming the ranking system? I mean it returns the value from 0 to 1, why the model still works for ratings?
  2. Am I correct that the scores which model returns is q_u * p_i + b_u + b_i (see the article)? If not, how can I calculate the scores myself? Where do they come from and why their magnitude is so high? I get the scores approximately from -100000 to +100000.

UPD1: I followed the comments and found out the following function:

cdef inline flt compute_prediction_from_repr(flt *user_repr,
                                             flt *item_repr,
                                             int no_components) nogil:

    cdef int i
    cdef flt result

    # Biases
    result = user_repr[no_components] + item_repr[no_components]

    # Latent factor dot product
    for i in range(no_components):
        result += user_repr[i] * item_repr[i]

    return result

It seems like the scores are indeed the formula above, but it would be helpful if someone could also have a look - I'm not very good with Cython

UPD2: sigmoid is used only for the logistic variant of the model. It's not used if you try WARP.

1

There are 1 best solutions below

0
Barath Srinivasan On

The model works for ratings using Sigmoid because LightFM binarizes the recommendation problem.

For ratings between 1 to 5 with 5 being the highest,

  • ratings 4 and 5 indicate user interest in the item -> Positive
  • ratings from 1 to 3 indicate user not interested in the item -> Negative

This is the reason model performance is indicated using a AUC score. For an individual user, AUC corresponds to the probability that a randomly chosen positive item will be ranked higher than a randomly chosen negative item.

In my case I applied the WARP Loss and use WARP score as an indicator to closeness of the item to the user in feature space to being liked by the User. For a probabilistic score or ratings prediction other sophisticated models may be considered.