Skip to content

P3 그래프 추천에서 행렬곱 질문입니다. #1

@theeluwin

Description

@theeluwin

안녕하세요..
코드를 보다보니 약간 궁금한 부분이 생겼습니다.

commerce의 4.4에서 P3 추천을 하는 부분에서 아래와 같은 코드가 있는데요:

-- Item:User x User:Item 그래프로 Item:Item 그래프 생성
drop table if exists tmp_p3_iter1;

create table tmp_p3_iter1 as
select item_index1, item_index2, prob
from (
   select
      item_index1, item_index2, prob, row_number() over (partition by item_index1 order by prob desc) as rank
   from
      (
        select
            a.item_index as item_index1,
            b.item_index as item_index2,
            sum(a.prob * b.prob) as prob
        from tmp_p3_graph a
        inner join tmp_p3_graph b
        on a.user_index = b.user_index and a.item_index != b.item_index
        group by a.item_index, b.item_index
   ) a
) a
where rank <= 100;

여기서 sum(a.prob * b.prob) as prob 하는 부분이 있는데,
a는 item → user 역할이고
b는 user → item 역할이기 때문에
b에선 user_prob을 가져오는게 맞지 않나요?
a에선 P(user|item)를, b에선 P(item|user)를 담당해주기 때문이라고 생각했습니다.
감사합니다.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions