https://velog.io/@rlawlsgus117/Paper-Review-Inductive-Representation-Learning-on-Temporal-Graphs
https://github.com/StatsDLMathsRecomSys/Inductive-representation-learning-on-temporal-graphs
source code에서 test-train data를 전부 df를 통해 접근하는 방식이여서
subreddit별로 test와 train을 미리 쪼개지 말고 MySQL에서 하나의 파일로 추출 후, 코드로 분할한다.
MySQL
WHERE from_unixtime(unix_timestamp(created_utc)-32400) < '2018-02-15 00:00:00' AND is_valid = 1
->
WHERE is_valid = 1 and UNIX_TIMESTAMP('2018-03-01 00:00:00') - UNIX_TIMESTAMP(created_utc) > 0
기존 코드는 np.quantile을 사용해, val_time, test_time = 0.7, 0.85로 설정했다.
사용할 데이터셋에서는 train data의 날짜가 fix되어 있어 수정이 필요했다.
valid_time - mysql에서 추출
+-----------------------------------------------------------------------------+
| UNIX_TIMESTAMP('2018-02-15 00:00:00')-UNIX_TIMESTAMP('2018-01-01 00:00:00') |
+-----------------------------------------------------------------------------+
| 3888000 |
+-----------------------------------------------------------------------------+
test_time - np.quantile 이용
test_time = np.quantile(g_df[g_df['ts'] > val_time].ts, 0.5)
val_time = 3888000
test_time = np.quantile(g_df[g_df['ts'] > val_time].ts, 0.5)
현재 데이터 - 2018년 1월 1일 ~ 3월4일의 posts/comments.
aim to - 2018년 1월 1일 ~ 2월28일의 posts/comments.