Recommender Systems - Collaborative filtering algorithm

Review of old Collaborative filtering

In the last few classes, we know that:

  • If you're given features for movies, you can use that to learn parameters \theta for users
     
    figure-1
  • If you're given parameters for the users, you can use that to learn features for movies
     
    figure-2

One thing you could do is go back and forth. Maybe randomly initialize parameter \theta, then solve for x. Then solve for better \theta, then better x, and so on.

Optimized Collaborative filtering algorithm objective

I want to point out that the two square error terms in figure-1 and figure-2 are actually the same, that is:

  

figure-3

  

  • The left hand is sum over all users j, and then sum over all movies rated by that user. 
  • The right hand just does things in the opposite order. For every movie i, sum over all the users j that have rated that movie.

So both summations on the left and right hands are just summations over all pairs (i,j) for which r(i,j)=1.

And thus, we have:

figure-4

So we can define the following cost function by putting above two cost functions in figure-1 and figure-2 together:

figure-5

It actually has an interesting property:

  • If you were to hold the xs constant, then you'll be solving exactly the problem of figure-1
  • If you were to hold the \theta s constant, then you'll be solving exactly the problem of figure-2

With the new cost function, instead of sequentially going back and forth between the two sets of parameters x and \theta, we'll just minimize with respect to both sets of parameters simultaneously.

Note:

With the new Collaborative filtering algorithm, we have x\in \mathbb{R}^{n} by doing away with the intercept term x_{0} which was set to 1 by convention. And similarly, \theta \in \mathbb{R}^{n}. The reason is we're now learning all the features automatically. There is no need to hard code the feature that is always equal to 1. If the algorithm really wants a feature that is always equal to 1, it can choose to learn one for itself. The algorithm has the flexibility to just learn it by itself.

Optimized Collaborative filtering algorithm

figure-6

Figure-6 shows the steps of Collaborative filtering algorithm. Firstly, we randomly initialize the feature x^{(1)} and parameter \theta ^{(1)} to some small values. Then minimize the features and parameters with GD or other advanced optimization algorithm. Then, suppose user j has not rated movie i yet, then the rating can be calculated as (\theta ^{(j)})^{T}x^{(i)}.

<end>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值