3

"Label" for One-Class Matrix Factorization

 3 years ago
source link: https://github.com/dotnet/machinelearning-samples/issues/873
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

sergey-tihon commented yesterday

edited

There is a sample in this project MatrixFactorization_ProductRecommendation for "One-Class Matrix Factorization"

In this sample traindata loaded from 2 column file and added one more Label column in the dataset
https://github.com/dotnet/machinelearning-samples/blob/master/samples/csharp/getting-started/MatrixFactorization_ProductRecommendation/ProductRecommender/Program.cs#L31-L39

var traindata = mlContext.Data.LoadFromTextFile(path:TrainingDataLocation,
                                                      columns: new[]
                                                                {
                                                                    new TextLoader.Column("Label", DataKind.Single, 0), // HERE
                                                                    new TextLoader.Column(name:nameof(ProductEntry.ProductID), dataKind:DataKind.UInt32, source: new [] { new TextLoader.Range(0) }, keyCount: new KeyCount(262111)), 
                                                                    new TextLoader.Column(name:nameof(ProductEntry.CoPurchaseProductID), dataKind:DataKind.UInt32, source: new [] { new TextLoader.Range(1) }, keyCount: new KeyCount(262111))
                                                                },
                                                      hasHeader: true,
                                                      separatorChar: '\t');

when column added it is filled with NaNs

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.

Page 28 of linked paper also state that

'One-Class Matrix Factorization' method is used when we know only positive ratings/samples (1s)

Why MatrixFactorization_ProductRecommendation sample does not fill Label column with all 1s before matrix factorization?

// cc @CESARDELATORRE

Update: Here is more detailed explanation


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK