da-analysis / asac_5_dataanalysis

ASAC 5기 Data Analysis Project (google map recommendation system)
0 stars 0 forks source link

아이템 to 아이템 데이터 탐색 #24

Open syleeie2310 opened 2 days ago

syleeie2310 commented 2 days ago

gmap_id : 아이템

gmap_id1, gmap_i2, 같이 리뷰 매긴 사람 갯수, .5점 같이 매긴 사람, 4점 이상 같이 매긴 사람 ㄴ co-occurence 이라는 개념

syleeie2310 commented 6 hours ago

개념적으로 다음과 같이 구현하면 어느정도 빠르게 계산됨


select gmap_id1, gmap_id2, count(distinct user_id) user_id_cnts, count(distinct case when .....) rating_4_over_user_id_cnts from( select a.gmap_id as gmap_id1, b.gmap_id as gmap_id2, a.user_id, a.rating as rating1, b.rating as rating2 from a as a inner join a as b on 1=1 and a.user_id =b.user_id ) as t where 1=1 and gmap_id1 != gmap_id2 group by gmap_id1, gmap_id2

syleeie2310 commented 6 hours ago

spark.sql = spark.dataframe.api

syleeie2310 commented 6 hours ago

탐색

1개 몇건인지? 2개인게 몇건인지? ......

da_cluster에서 작업

syleeie2310 commented 4 hours ago

아까 말하려고 했던 용어가 Cartesian Product 입니다. 검색하면 실질적으로 cross join 형태로 이해하시면 되고 제가 알려준 방식이 아래 형태랑 비슷하네요.

How to generate co-occurence datatable using either Spark SQL, Pyspark or R spark

syleeie2310 commented 4 hours ago

계산 할 때 아이템 X 아이템 예상하는 기대값이 너무 커서 연산이 어려우면 리뷰가 동일한 월 기준으로 매긴 사람만 계산할 수도 있는데 그럼 join 조건에 추가하면 됩니다. 우선 리뷰가 많은 gmap_id 샘플로 100개 정도만 코드로 작업해서 확장하시는게 좋을 듯 해요