Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Label column meaning in Recommendation sample #1

Merged
merged 1 commit into from
Jan 5, 2021

Conversation

sergey-tihon
Copy link
Contributor

I think that the meaning of Label column is incorrect in your post

The Label column is our goal, it is what we want to predict, which in this case is mapped to the “CombinedProductID” field annotated with the Label ColumnName Attribute of the Product Record-type.

According to documentation for MatrixFactorizationTrainer Class

The coordinate descent method included is specifically for one-class matrix factorization where all observed ratings are positive signals (that is, all rating values are 1). Notice that the only way to invoke one-class matrix factorization is to assign one-class squared loss to loss function when calling MatrixFactorization(Options). See Page 6 and Page 28 here for a brief introduction to standard matrix factorization and one-class matrix factorization.

so the trainer expect input (sparse matrix) in the format

A.[ProductID, CombinedProductID] <- 1.0f

instead of this you provide matrix

A.[ProductID, CombinedProductID] <- CombinedProductID

A.[i,j] should represent likelihood of co-purchase, 1 means co-purchase and 0 is most likely no.

In this case trainer with factorize matrix and fill missing probabilities/likelyhood.

Page 28 of referenced paper also explain that https://www.csie.ntu.edu.tw/%7Ecjlin/talks/facebook.pdf

image

Output

With this fix, input matrix contain 0s and 1s and it is way more easier to factorize.

This is the result from your post
image

This is the result from this PR
image

RootMeanSquaredError and MeanSquaredError several order of magnitude smaller, but prediction for product 61 is similar =)

@rikace rikace merged commit e9d56a9 into rikace:main Jan 5, 2021
@rikace
Copy link
Owner

rikace commented Jan 5, 2021

Well done!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants