-
Notifications
You must be signed in to change notification settings - Fork 5
/
main.py
96 lines (77 loc) · 3.26 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
from utils import load_pickle
from prep.game_prep import gameloader
# from prep.review_prep import allreviewloader
from prep.dataloader import dataloader
from nlp.lda import genre_lda, content_lda, review_lda
from nlp.sentiment import sentiment_analysis
# from embedding.game2vec import game2vec
from model.gmf import gmf_run
from model.mlp import mlp_run
from model.nmf import nmf_run
from model.dcn import dcn_p_run, dcn_s_run
from model.deepfm import deepfm_run
if __name__ == '__main__':
'''
1. Data load
'''
# ----- review (게임, 유저, 리뷰가 병합된 데이터)
train_modified, val_modified, test_modified = dataloader() # split version
# all_review = allreviewloader()
# ----- game (LDA를 위한 게임 메타정보 데이터)
game = gameloader()
'''
2. NLP
'''
# ----- LDA
content_topic = content_lda(game); genre_topic = genre_lda(game)
train_modified = review_lda(train_modified, content_topic, genre_topic)
val_modified = review_lda(val_modified, content_topic, genre_topic)
test_modified = review_lda(test_modified, content_topic, genre_topic)
# ----- Sentiment Analysis
train_modified = sentiment_analysis(train_modified)
val_modified = sentiment_analysis(val_modified)
test_modified = sentiment_analysis(test_modified)
'''
3. Game Embedding
'''
# _ = game2vec(all_review, game)
gamevec = load_pickle('norm_game2vec.pickle')
'''
4. model
'''
# ----- gmf
_, gmf_acc, gmf_auc, gmf_f1 = gmf_run(train_modified, val_modified, test_modified, gamevec)
print('========== GMF Score ==========')
print('ACC : {:.4f}'.format(gmf_acc))
print('AUC : {:.4f}'.format(gmf_auc))
print('F1 Score : {:.4f}'.format(gmf_f1))
# ----- mlp
_, mlp_acc, mlp_auc, mlp_f1 = mlp_run(train_modified, val_modified, test_modified, gamevec)
print('========== MLP Score ==========')
print('ACC : {:.4f}'.format(mlp_acc))
print('AUC : {:.4f}'.format(mlp_auc))
print('F1 Score : {:.4f}'.format(mlp_f1))
# ----- nmf
nmf_acc, nmf_auc, nmf_f1 = nmf_run(train_modified, val_modified, test_modified, gamevec)
print('========== NMF Score ==========')
print('ACC : {:.4f}'.format(nmf_acc))
print('AUC : {:.4f}'.format(nmf_auc))
print('F1 Score : {:.4f}'.format(nmf_f1))
# ----- deepfm
deepfm_acc, deepfm_auc, deepfm_f1 = deepfm_run(train_modified, val_modified, test_modified, gamevec)
print('========== DeepFM Score ==========')
print('ACC : {:.4f}'.format(deepfm_acc))
print('AUC : {:.4f}'.format(deepfm_auc))
print('F1 Score : {:.4f}'.format(deepfm_f1))
# ----- dcn (parallel)
dcn_p_acc, dcn_p_auc, dcn_p_f1 = dcn_p_run(train_modified, val_modified, test_modified, gamevec)
print('========== DCN_parallel Score ==========')
print('ACC : {:.4f}'.format(dcn_p_acc))
print('AUC : {:.4f}'.format(dcn_p_auc))
print('F1 Score : {:.4f}'.format(dcn_p_f1))
# ----- dcn (stacked)
dcn_s_acc, dcn_s_auc, dcn_s_f1 = dcn_s_run(train_modified, val_modified, test_modified, gamevec)
print('========== DCN_stacked Score ==========')
print('ACC : {:.4f}'.format(dcn_s_acc))
print('AUC : {:.4f}'.format(dcn_s_auc))
print('F1 Score : {:.4f}'.format(dcn_s_f1))