Machine Learning第九讲[推荐系统] --(二)协同过滤

内容来自Andrew老师课程Machine Learning的第九章内容的Collaborative Filtering部分。

一、Collaborative Filtering(协同过滤)

协同过滤能够自行学习所需要使用的特征。
来看下面的例子:
Movie Alice(θ1) Bob(θ2) Carol(θ3) Dave(θ4) x1
(romance)
x2
(action)
Machine Learning第九讲[推荐系统] --(二)协同过滤:Love at last 5 5 0 0 ? 1.0 ? 0.0
Machine Learning第九讲[推荐系统] --(二)协同过滤:Romance forever 5 ? ? 0 ?
Machine Learning第九讲[推荐系统] --(二)协同过滤:Cute pupies of love ? 4 0 ? ?
Machine Learning第九讲[推荐系统] --(二)协同过滤:Nonstop car chases 0 0 5 4 ?
Machine Learning第九讲[推荐系统] --(二)协同过滤:Swaord vs. karate 0 0 5 ? ?

在之前讲的基于内容的推荐系统中,我们需要事先建立特征并知道特征值,这是比较困难的。
假设我们某一用户的喜好,即假如Alice、Bob喜欢romance的电影,carol、Dave喜欢action的电影,则:
Machine Learning第九讲[推荐系统] --(二)协同过滤
就拿Alice来说,Alice只对romance感兴趣,因此只有x1=5,x0和x2都为0。
我们不需要在意电影的名字,只需要知道对于第一部电影,Alice和Bob都给了5分,而Alice和Bob都喜欢romance的电影,因此极有可能对于第一部电影来说,x1=1.0,x2=0
因此

                                                                                               Machine Learning第九讲[推荐系统] --(二)协同过滤

又因为对于第一部电影,4个人都给了评分,因此有下列公式:

                                                                                             Machine Learning第九讲[推荐系统] --(二)协同过滤

即我们通过θ来预测x。
下面是优化目标:
Machine Learning第九讲[推荐系统] --(二)协同过滤
我们该怎样将之前基于内容的推荐算法和本部分内容结合呢?
Machine Learning第九讲[推荐系统] --(二)协同过滤


二、Collaborative Filtering Algorithm(协同过滤算法)


在上面提到我们可以通过不过x --> θ --> x --> θ --> x --> ....的过程来求出θ和x的最优值,这个过程比较复杂,下面有一种更简单的方法,我们可以同时求出x和θ的值:

Machine Learning第九讲[推荐系统] --(二)协同过滤


整理一下协同过滤算法的流程:

Machine Learning第九讲[推荐系统] --(二)协同过滤

Machine Learning第九讲[推荐系统] --(二)协同过滤