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

发布时间:2024年01月18日

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=21?j=1nu??i:r(i,j)=1?(w(j)?x(i)?b(j)?y(i,j))2+2λ?j=1nu??k=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=21?j=1nu??i:r(i,j)=1?(w(j)?x(i)?b(j)?y(i,j))2+2λ?j=1nu??k=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)=21?j=1nu??i:r(i,j)=1?(w(j)?x(i)?b(j)?y(i,j))2+2λ?j=1nu??k=1n?(wk(j)?)2+j=1nu??k=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+e?z1?f(x)=g(w(j)?x(i)?b(j)))L=?y(i,j)log(f(x))?(1?y(i,j))log(1?f(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(regularization?term)

在这里插入图片描述

文章来源:https://blog.csdn.net/m0_65591847/article/details/135641918
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。