[데이터마이닝] 9.추천 시스템(recommendation system) 9.3절 연습문제 (Exercise 9.3)
연습문제 9.3.1 a) 다목적 행렬을 불린(Boolean)라 가정하고, 각 사용자 쌍들의 자카드 거리를 계산하라. A=c(1,1,0,1,1,0,1,1) B=c(0,1,1,1,1,1,1,0) C=c(1,0,1,1,0,1,1,1) #A,B sum( A & B ) / sum(A|B) #B,C sum( B & C ) / sum( B | C ) #C,A sum( C & A ) / sum( C | A ) b)코사인 거리로 a)를 반복하여라 sum(A * B) / ( sqrt(sum(A^2)) * sqrt(sum(B^2)) ) sum(C * B) / ( sqrt(sum(C^2)) * sqrt(sum(B^2)) ) sum(A * C) / ( sqrt(sum(A^2)) * sqrt(sum(C^2)) ) C) 순위 3,..
[데이터마이닝] 5.링크분석(Link analysis) 5.5절 연습문제(Exercise 5.5)
Exercise 5.5.1 : Compute the hubbiness and authority of each of the nodes in our original Web graph of Fig. 5.1. n = 4 sqrt(n) a = c(1/2,1/2,1/2,1/2) h = c(1/2,1/2,1/2,1/2) A = matrix(c(0,1,1,1, 1,0,0,1, 1,0,0,0, 0,1,1,0), nrow = 4) h = A%*%a h = h/max(h) a = t(A)%*%h a = a/max(a) pre_h =0 pre_a =0 while(pre_h != h || pre_a != a){ pre_h = h h = A%*%a h = h/max(h) pre_a = a a = t(A)%*%h a = a/max..