Skip to content

Instantly share code, notes, and snippets.

@ryancat
Last active May 30, 2018 05:05
Show Gist options
  • Select an option

  • Save ryancat/da03e02b2a97d058fdbfa196d31fcee4 to your computer and use it in GitHub Desktop.

Select an option

Save ryancat/da03e02b2a97d058fdbfa196d31fcee4 to your computer and use it in GitHub Desktop.
Notes taken from building a tensorflow recommendation engine

Build a tensorflow recommendation engine

Related links

Research

Starts by doing some spikes on what's available there. A quick search on google gives the following potential resources:

I feel it would be a good start to learn the end-to-end solution from the overview document above. Will start taking notes from there.

Background theories

  • Filtering

    • Content-based: A popular, recommended product has similar attributes to what the user views or likes.
    • Cluster: Recommended products go well together, no matter what other users have done.
    • Collaborative: Other users, who like the same products the user views or likes, also liked a recommended product.
  • Collaborative filtering

    • The assumption of this technique is similar user bahaver reflects similar fundamental preferences
      • Users who interact with items in a similar manner share one or more hidden preferences
      • Users with shared preferences are likely to respond in the same way to the (other) same items
    • This technique requires no access to the user preferences nor the item content
  • Matrix factorization

    • This is a math model to solve the collaborative filtering problem
      • Assume each item shares same set of hidden factors (or latent factors) and expresses them in different level
      • Assume each user has their own perference on the set of hidden factors, independent to the items
      • With the above assumptions, a user's predicted rating on an item can be calculated by summing all the rating for hidden factors, which is user's preference level on that factor weighted by item's degree of expressing it.
    • The math model, as the name suggests, is using a matrix format.
    • The loss function is calculated by the suqared error on actual rating with the above prediction, plus some regularization terms to prevent overfitting
    • The goal of machine learning here is to find how the arbitrary number of hidden factors are expressed by items, and liked by users
    • You can find a nice picture to explain how the matrix looks like here
  • WALS method for matrix factorization

    • ALS stands for alternating least squares method
      • The method assumes one factor matrix (for example, the column factors) to constant values
      • It takes the derivative of the loss function with respect to the row factors (the other factor matrix)
      • Set the derivative to zero to get the local peak value
    • WALS stands for weighted alternating least squares method
      • Besides ALS, WALS starts with a weighted loss function, which often has better performance
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment