Skip to content

백준 문제 추천 서비스를 위한 모델 서버

Notifications You must be signed in to change notification settings

boaz-baekjoon/baekjoon-model

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Title

Abstract

BOJ PS problem Recsys Server bulit with

Introduction

This GitHub repository contains the source code for BOJ problem recommendation system server, which provides APIs that the baekjoon Bot server can request in various user needs situations. The recommendation was implemented through a sequential recommendation model and a hybrid graph model combining Collaborative Filtering (CF) and Knowledge Graph (KG). These AI models were built with Pytorch and served with FastAPI. In addition, appropriate transformation was performed on the pre-loaded PostgreSQL data and a data mart for the model server was built using duckdb.

Data

Used the problem solving status and problem information data of silver level or higher users crawled from BOJ.

  • user number : about 110,000 people
  • problum number : about 30000
  • interaction : about 17 million

Recommendation Model

SASRec

  • SASRec is a classically used model in the field of sequential recommendation.
  • Chose SASRec as a personalized recommendation model due to its parallel processing capability, efficiency in space complexity, and fast inference time.
  • The paper author's legacy tensorflow code was rewritten in pytorch.
  • The default values ​from the paper were used as hyperparameters.

KGAT

  • KGAT is a hybrid graph model that models Collaborative Filtering information and side information as CF graph and knowledge graph, respectively.
  • Used KGAT to generate item embeddings by appropriately using CF information and side information.
  • Some typos and unnecessary operations were corrected in the existing author's code.
  • For most hyperparameters, the default values ​​from the paper were used. However, we reduce the embedding dimension and number of layers
  • As a result of the experiment, when the embedding dimension was low, loss was reduced better. Perhaps the recommendation problem we are trying to solve is expected to be at a low dimension.

Recommendation System

Figure describing overall system design of the recommendation system.

Alt text

how to use

🖥️ Running the server locally

cd baekjoon-model
uvicorn server:app --host 0.0.0.0 --port {PORTNUM} --reload

📄 endpoints docs

endpoint method Model explanation Request Response
baekjun/user_id POST SASRec Recommend problems based on the user's history of problems solved in the past. {
”user_id_list”: List[str],
”problem_num”:int
}
{
”{user_id1}”:[problems_list],
”{user_id2}”:
[problems_list]
...}
baekjun/category POST SASRec Recommend problems of the problem type selected by user. {
”user_id_list”: str,
”category”:int
”problem_num”:int
}
{
”user_id” : List[int]
}
baekjun/group_rec POST SASRec Recommend problems of the tier and problem type selected by group users. {
”user_id_list” : List[str],
”tier” : int,
”category_num” : List[int]
}
{
”0” : List[int],
”1” : List[int],
…,
”9” List[int]
}
baekjun/similar_id POST KGAT Recommend problems similar to the problem submitted by the user. {
”problem_id” : int,
”problem_num” : int
}
{
”problem_id” : List[int]
}

References

@inproceedings{kang2018self,
  title={Self-attentive sequential recommendation},
  author={Kang, Wang-Cheng and McAuley, Julian},
  booktitle={2018 IEEE international conference on data mining (ICDM)},
  pages={197--206},
  year={2018},
  organization={IEEE}
}

@inproceedings{wang2019kgat,
  title={Kgat: Knowledge graph attention network for recommendation},
  author={Wang, Xiang and He, Xiangnan and Cao, Yixin and Liu, Meng and Chua, Tat-Seng},
  booktitle={Proceedings of the 25th ACM SIGKDD international conference on knowledge discovery \& data mining},
  pages={950--958},
  year={2019}
}

About

백준 문제 추천 서비스를 위한 모델 서버

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages