机器学习(九) — 协同滤波与基于内容的滤波

Collaborative and Content-based filter

1 collaborative filter

1. definition

recommend items based on rating of users who gave similar rating

2. cost function

  1. learn w ( 1 ) , b ( 1 ) , ⋯   , w ( n u ) , b ( n u ) w^{(1)}, b^{(1)}, \cdots, w^{(n_u)}, b^{(n_u)} w(1),b(1),,w(nu),b(nu)

J = 1 2 ∑ j = 1 n u ∑ i : r ( i , j ) = 1 ( w ( j ) ⋅ x ( i ) − b ( j ) − y ( i , j ) ) 2 + λ 2 ∑ j = 1 n u ∑ k = 1 n ( w k ( j ) ) 2 J = \frac{1}{2}\sum_{j=1}^{n_u} \sum_{i:r(i,j) = 1}(w^{(j)} \cdot x^{(i)} - b^{(j)} - y^{(i, j)})^2 + \frac{\lambda}{2} \sum_{j=1}^{n_u} \sum_{k=1}^{n}(w_k^{(j)})^2 J=21j=1nui:r(i,j)=1(w(j)x(i)b(j)y(i,j))2+2λj=1nuk=1n(wk(j))2

  1. learn x ( 1 ) , ⋯   , x ( n m ) x^{(1)}, \cdots, x^{(n_m)} x(1),,x(nm)

J = 1 2 ∑ j = 1 n u ∑ i : r ( i , j ) = 1 ( w ( j ) ⋅ x ( i ) − b ( j ) − y ( i , j ) ) 2 + λ 2 ∑ j = 1 n u ∑ k = 1 n ( x k ( i ) ) 2 J = \frac{1}{2}\sum_{j=1}^{n_u} \sum_{i:r(i,j) = 1}(w^{(j)} \cdot x^{(i)} - b^{(j)} - y^{(i, j)})^2 + \frac{\lambda}{2} \sum_{j=1}^{n_u} \sum_{k=1}^{n}(x_k^{(i)})^2 J=21j=1nui:r(i,j)=1(w(j)x(i)b(j)y(i,j))2+2λj=1nuk=1n(xk(i))2

  1. collaborative filter

J ( w , b , x ) = 1 2 ∑ j = 1 n u ∑ i : r ( i , j ) = 1 ( w ( j ) ⋅ x ( i ) − b ( j ) − y ( i , j ) ) 2 + λ 2 ∑ j = 1 n u ∑ k = 1 n ( w k ( j ) ) 2 + ∑ j = 1 n u ∑ k = 1 n ( x k ( i ) ) 2 J(w, b, x) = \frac{1}{2}\sum_{j=1}^{n_u} \sum_{i:r(i,j) = 1}(w^{(j)} \cdot x^{(i)} - b^{(j)} - y^{(i, j)})^2 + \frac{\lambda}{2} \sum_{j=1}^{n_u} \sum_{k=1}^{n}(w_k^{(j)})^2 + \sum_{j=1}^{n_u} \sum_{k=1}^{n}(x_k^{(i)})^2 J(w,b,x)=21j=1nui:r(i,j)=1(w(j)x(i)b(j)y(i,j))2+2λj=1nuk=1n(wk(j))2+j=1nuk=1n(xk(i))2

  1. for binary labels

g ( x ) = 1 1 + e − z f ( x ) = g ( w ( j ) ⋅ x ( i ) − b ( j ) ) ) L = − y ( i , j ) l o g ( f ( x ) ) − ( 1 − y ( i , j ) ) l o g ( 1 − f ( x ) ) j ( w , b , x ) = ∑ L g(x) = \frac{1}{1+e^{-z}}\\ f(x) = g(w^{(j)} \cdot x^{(i)} - b^{(j))})\\ L = -y^{(i, j)}log(f(x)) - (1 - y^{(i, j)})log(1-f(x))\\ j(w, b, x) = \sum L g(x)=1+ez1f(x)=g(w(j)x(i)b(j)))L=y(i,j)log(f(x))(1y(i,j))log(1f(x))j(w,b,x)=L

2 Content-based filter

1. definition

recommand items based on fearures of user and item to find good match

2. cost function
J = ∑ ( i , j ) : r ( i , j ) = 1 ( v u ( j ) v m ( j ) − y ( i , j ) ) 2 + N N ( r e g u l a r i z a t i o n − t e r m ) J = \sum_{(i, j):r(i, j)=1}(v_u^{(j)}v_m^{(j)} - y^{(i, j)})^2 + NN(regularization-term) J=(i,j):r(i,j)=1(vu(j)vm(j)y(i,j))2+NN(regularizationterm)

机器学习(九) — 协同滤波与基于内容的滤波_第1张图片

你可能感兴趣的:(机器学习,人工智能)