Open NatElkins opened 5 years ago
On point (3), you don't need both. If I recall correctly, there was a point where samples got updated to go from one method to the other (attribute based approach), but there were issues (at the time) that meant this sample didn't update. The attributes just happen to remain but could be removed.
The main issue here is UserId
is being loaded as a Key
of count 6248UL. Looking at the data you have, UserId
doesn't fit this definition. So it's good that it gets mapped to a key, but it doesn't make sense to load it as a key. So try updating as follows
[<CLIMutable>]
type ProductEntry =
{
UserId : uint32
ProductId : string
Label : float32
}
and
let traindata =
let columns =
[|
TextLoader.Column("Label", DataKind.Single, 0)
TextLoader.Column("UserId", DataKind.UInt32, source = [|TextLoader.Range(0)|])
TextLoader.Column("ProductId", DataKind.String, source = [|TextLoader.Range(1)|])
|]
mlContext.Data.LoadFromTextFile(trainDataPath, columns, hasHeader=false, separatorChar=',')
@kevmal You're right, removing the label and key counts result in an actual score. Thank you (note to MS devs, an error or warning log might be helpful here)!!!
I have a few other questions, maybe you can help answer them:
Thanks again for your help, I really appreciate it!
Hi,
I am trying to adapt the F# product recommendation sample to a small set of data that I have.
There are three main differences between my data and the Amazon data set:
My issue is that I can only get a score of NaN for any prediction. I am unable to determine a way to diagnose this, maybe someone here can help?
Here's my code:
Even when selecting a UserId-ProductId combination that is in the file, I get a score of NaN.
So, I have a few questions:
My data set can be found here: user_product_prediction.txt
To try it out, just replace the Program.fs in the matrix factorization product recommendation F# sample with the program I pasted above. Download the txt file and change the path to the file as appropriate.
Any help or a pointer in the right direction would be deeply appreciated!
Thanks!