Machine Learning第九讲[推荐系统] --(一)基于内容的推荐系统
内容来自Andrew老师课程Machine Learning的第九章内容的Predicting Movie Ratings部分。
先介绍本篇博文需要用到的字母及其含义:
: no. of users
: no. of movies
- r(i, j)=1: if user j has rated movie i
: rating given by user j to movie i ( defined only if r(i, j)=1 )
: parameter vector for user j
: feature vector for movie i
: no. of movies rated by user j
Movie | Alice(1) | Bob(2) | Carol(3) | Dave(4) | x1 (romance) |
x2 (action) |
5 | 5 | 0 | 0 | 0.9 | 0 | |
5 | ? | ? | 0 | 1.0 | 0.01 | |
? | 4 | 0 | ? | 0.99 | 0 | |
0 | 0 | 5 | 4 | 0.1 | 1.0 | |
0 | 0 | 5 | ? | 0 | 0.9 |
对于每一个用户j,假设我们已经通过学习找到参数
,则用户j对电影i的评分预测值为:
。
对于上面的例子:
假设已知:
则Alice(j=1)对Cute pupies of love(i=3)的评分将被预测为:
下面我们来看怎么来求θ值:
这个公式其实是线性回归的变种,它和线性回归有很多相似的样子,其思路也很相似,代价函数都是预测值和实际值的差值平方和。