mhahsler / recommenderlab

recommenderlab - Lab for Developing and Testing Recommender Algorithms - R package
213 stars 61 forks source link

Predict ratingmatrix #28

Closed MounirHader closed 5 years ago

MounirHader commented 5 years ago

Hi @mhahsler, a follow-up on the previous bug: when calling predict with type=ratingmatrix the model returns the actual ratings on the positions of known ratings instead of the ratings predicted by the model (the normalization issue seems fixed).

For example if my known ratings for user X are:

NA NA 1 NA 5 NA 5

The predictions are

2.58 2.54 1.00 3.87 5.00 2.59 5.00

Hope to hear from you!

MounirHader commented 5 years ago

I'm currently looking at the code in predict.R and trying to figure out what line 23 and 25 are for. I think that removing these lines will solve the problem: the ratings in "rm" are already normalized and consist of (I think?) the model's predictions. No need to do any further evaluations using the newdata variable, right? The matrix rm is already the desired output as far as I can judge

mhahsler commented 5 years ago

That is correct. I am currently thinking about what the right thing to do is here. Maybe I should not replace the predictions with the known values.

MounirHader commented 5 years ago

Thank you for looking into this. I think removing the lines I mentioned should do the trick, and as you said: replacing the predictions with known values does not make sense, as they are predictions and not ground truths :). It would be much appreciated if this can be changed in the code soon, as I am highly dependent of the software for my current research.

mhahsler commented 5 years ago

This makes sense. I have changed it on GitHub. Please install the package from there for now. It will be part of the next scheduled release.