locked
Matchbox Implementation Questions RRS feed

  • Question

  • I am trying to get the Matchbox recommendation system working based on the tutorial given here:

    http://research.microsoft.com/en-us/um/cambridge/projects/infernet/docs/Recommender%20System.aspx

    I am trying to modify the code so that it will read in the ratings from a 3 column file (userID, itemID, rating). I don't see how the the arrayInit function works for loading in the ratings.

    I have modified the RecommenderSystem.cs in the Samples/C#/ExamplesBrowser directory to read the data from a file:

    file = new System.IO.StreamReader(@"C:\FILE_LOCATION\3col.arff");
    count = 0;
    int[] observedUserData = new int[numObservations.ObservedValue];
    int[] observedItemData = new int[numObservations.ObservedValue];
    bool[][] observedRatingData = new bool[numObservations.ObservedValue][];
    while ((line = file.ReadLine()) != null)
    {
       //split the ratings lines
       string[] split = line.Split(',');
       int userVal = Convert.ToInt32(split[0]);
       int itemVal = Convert.ToInt32(split[1]);
       int rate = Convert.ToInt32(split[2]);
    
       observedUserData[count] = userVal;
       observedItemData[count] = itemVal;
       observedRatingData[count] = new bool[numLevels];
       for (int i = 0; i < numLevels; i++)
       {
          observedRatingData[count][i] = (i > rate - 1);
       }
       count++;
    }
    file.Close();
    

    This is used rather than the GenerateData function call. I am getting error, however, from this line:

    var userTraitsPosterior = engine.Infer<Gaussian[][]>(userTraits);
    stating that the array index is too large. Any help would be appreciated.

    Also, I want to add meta-data to 2009 paper "Matchbox: Large Scale Online Bayesian Recommendations." the author state that the a dot product is used to combine the information. However, Figure 1 shows a simple summation. I am assuming that the values are multiplied together first for the dot product and then summed.

    Finally, can Matchbox provide recommendations for users with absolutely no users? It seems like Matchbox requires at least some users.


    • Edited by M.R.Smith Monday, November 17, 2014 8:27 PM
    Monday, November 17, 2014 6:32 PM

All replies

  • Hi there,

    In only a few weeks we'll release an updated version of the Matchbox recommender which does everything you need - read data, make use of user and item features, make cold-start predictions. If you can't afford to wait that long, please read on.

    1. You're not providing sufficient information for me to answer where the index range exception comes from. Please debug the problem to find the line of generated code which is throwing. Then it'll be much easier to resolve the issue. 
    2. Feature weights are learned globally (as opposed to per user/item, like traits are). Feature weights are learned per feature and per trait. The adjusted trait vector for a given user/item is modelled as the trait vector for this entity plus the inner product of the feature weights and the feature values. Note that this is mathematically equivalent to using the feature inner product as a prior for the traits. The latter approach avoids an extra symmetry though ans is therefore preferred. This is shown on the factor graph below.
    3. Matchbox can indeed make recommendations for users with no ratings (I assume this is what you meant). We call these "cold-start users". Just use the prior for these users, or some average of the learned posteriors. I don't feel like I'm doing a good job at answering this question, so please ask more concretely.

    Points 2. and 3. are explained in much more detail in the documentation of the upcoming recommender.

    Matchbox factor graph

    -Yordan

    Thursday, November 20, 2014 4:38 PM
  • That sounds great. Thanks! I will look forward to seeing the updated version.
    Friday, November 21, 2014 4:58 PM
  • The new version of Infer.NET is now up.
    Saturday, November 29, 2014 6:04 PM
    Owner