Skip to content

Commit

Permalink
Merge pull request #30 from boostcampaitech6/feat/29-add-recbole-gene…
Browse files Browse the repository at this point in the history
…ral-model

[FEAT] Add model in Recbole #29
  • Loading branch information
Minseojeonn authored Feb 21, 2024
2 parents da9ab28 + 8738f23 commit 13be27e
Show file tree
Hide file tree
Showing 9 changed files with 188,457 additions and 188,371 deletions.
7 changes: 4 additions & 3 deletions Recbole/Data_convert.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,12 @@
"os.makedirs(\"./dataset\", exist_ok=True)\n",
"#inter file\n",
"inter_file = train.copy()\n",
"inter_file['rating'] = 1.0\n",
"inter_file = inter_file.rename(\n",
" columns={\n",
" \"user\":\"user_id:token\",\n",
" \"item\":\"item_id:token\",\n",
" #\"rating\":\"rating:float\",\n",
" \"rating\":\"rating:float\",\n",
" \"time\":\"timestamp:float\"\n",
" }\n",
")\n",
Expand Down Expand Up @@ -141,7 +142,7 @@
" inplace=True,\n",
")\n",
"\n",
"item_file.to_csv(\"./dataset/ML.item\", sep='\\t', index=False)\n"
"item_file.to_csv(\"./dataset/ML/ML.item\", sep='\\t', index=False)\n"
]
},
{
Expand Down Expand Up @@ -175,7 +176,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.0"
"version": "3.9.18"
}
},
"nbformat": 4,
Expand Down
8 changes: 6 additions & 2 deletions Recbole/configs/Dataset/ML_sequence.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,13 @@ dataset: 'ML'
USER_ID_FIELD: user_id
ITEM_ID_FIELD: item_id
TIME_FIELD: timestamp
load_col:
inter: [user_id, item_id, timestamp]
ITEM_LIST_LENGTH_FIELD: item_length
LIST_SUFFIX: _list
MAX_ITEM_LIST_LENGTH: 50
repeatable : True
RATING_FIELD: rating # (str) Field name of rating feature.
LABEL_FIELD: rating
load_col:
inter: ['user_id', 'item_id', 'timestamp', 'rating']
user: ['user_id']
item: ['item_id', 'director', 'class', 'writer', 'release_year']
1 change: 1 addition & 0 deletions Recbole/configs/Model/FM.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
embedding_size: 10 # (int) The embedding size of features.
10 changes: 5 additions & 5 deletions Recbole/configs/Training/train.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
epochs: 300 # (int) The number of training epochs.
train_batch_size: 2048 # (int) The training batch size.
learner: adam # (str) The name of used optimizer.
learning_rate: 0.001 # (float) Learning rate.
learning_rate: 0.01 # (float) Learning rate.
train_neg_sample_args: # (dict) Negative sampling configuration for model training.
distribution: uniform # (str) The distribution of negative items.
sample_num: 1 # (int) The sampled num of negative items.
alpha: 1.0 # (float) The power of sampling probability for popularity distribution.
dynamic: False # (bool) Whether to use dynamic negative sampling.
candidate_num: 0 # (int) The number of candidate negative items when dynamic negative sampling.
sample_num: 3 # (int) The sampled num of negative items.
alpha: 0.5 # (float) The power of sampling probability for popularity distribution.
#dynamic: True # (bool) Whether to use dynamic negative sampling.
#candidate_num: 500 # (int) The number of candidate negative items when dynamic negative sampling.
eval_step: 1 # (int) The number of training epochs before an evaluation on the valid dataset.
stopping_step: 10 # (int) The threshold for validation-based early stopping.
clip_grad_norm: ~ # (dict) The args of clip_grad_norm_ which will clip gradient norm of model.
Expand Down
30 changes: 29 additions & 1 deletion Recbole/configs/config_combination.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,32 @@ Model_name / eval.yaml / Model.yaml / .... etc..
ease ./configs/EVAL/eval_ease.yaml ./configs/Model/EASE.yaml
recvae ./configs/EVAL/eval_rec_vae.yaml ./configs/Model/RecVae.yaml
sasrec ./configs/EVAL/eval_sasrec.yaml ./configs/Model/Sasrec.yaml ./configs/Training/SasrecTrain.yaml ./configs/Dataset/ML_sequence.yaml
lightgcn ./configs/EVAL/eval_lightgcn.yaml ./configs/Model/LightGCN.yaml
lightgcn ./configs/EVAL/eval_lightgcn.yaml ./configs/Model/LightGCN.yaml ./configs/Training/train.yaml
fm ./configs/Model/FM.yaml ./configs/Dataset/ML_sequence.yaml ./configs/Training/train.yaml
pop
nais
neumf
convncf
dmf
fism
spectralcf
gcmc
ngcf
dgcf
line
multidae
macridvae
cdae
enmf
nncf
ract
slimelastic
sgl
admmslim
nceplrec
simplex
ncl
random

diffrec
ldiffrec
Loading

0 comments on commit 13be27e

Please sign in to comment.