Open danyang-liu opened 5 years ago
After training, You can run the predict(int userIdx, itemIdx)
function with the testMatrix.
// after training
for (MatrixEntry me : testMatrix) {
int userIdx = me.row(); // user
int itemIdx = me.column(); // item
double predictRating = predict(userIdx, itemIdx);
}
Can predict() be run form command line?
Hi SunYatong: Thanks, I will try.
Can we predict values for a test set from the command line?
Can we predict values for a test set from the command line? That is, instead of storing predicted values for training data or top-N values among the whole item set (in case of ranking based recommendation algorithm), can we store predicted values of a given test set from command line?
@mvijaikumar Command line doesn't support this. You can denote the test set before training with TestSetSplitter, and add the code after training.
// after training
for (MatrixEntry me : testMatrix) {
int userIdx = me.row(); // user
int itemIdx = me.column(); // item
double predictRating = predict(userIdx, itemIdx);
}
@SunYatong Thank you for your response. I am facing a peculiar problem in doing so as described above. If (userid, itemid) pair is not a part of a training set, and part of a test set (for obvious reason), testMatrix does not contain that pair.
I tested this on PMFRecommender. I could not understand why it is happening. Can you help me out?
So you want to get the prediction of arbitrary user-item pairs? @mvijaikumar
I want to predict rating for user and item that is part of training set, however, the exact pair is not a part of training set. That is, user is part of training set, itme is part of training set.
On Mon, Feb 11, 2019, 17:45 SunYatong <notifications@github.com wrote:
So you want to get the prediction of arbitrary user-item pairs?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/guoguibing/librec/issues/280#issuecomment-462307537, or mute the thread https://github.com/notifications/unsubscribe-auth/AeROdZSWIathgc6vjU4ZVqZ5Ud9tg48Oks5vMV74gaJpZM4XbJ9G .
I want to predict rating for user and item that is part of training set, however, the exact pair is not a part of training set. That is, user is part of training set, item is part of training set.
On Mon, Feb 11, 2019, 17:45 SunYatong <notifications@github.com wrote:
So you want to get the prediction of arbitrary user-item pairs?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/guoguibing/librec/issues/280#issuecomment-462307537, or mute the thread https://github.com/notifications/unsubscribe-auth/AeROdZSWIathgc6vjU4ZVqZ5Ud9tg48Oks5vMV74gaJpZM4XbJ9G .
So you do want to get the prediction of arbitrary user-item pairs... @mvijaikumar
Just use
predict(userIdx, itemIdx)
I use BPR. I want to get the predict results for the u-i pairs in testset. But the results in ./result/ is the top_n item_rating for these users, not the items I want to predict.