-
Notifications
You must be signed in to change notification settings - Fork 73
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1788a99
commit 18f6c23
Showing
76 changed files
with
1,021,418 additions
and
387 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,23 @@ | ||
from data.loader import FileIO | ||
|
||
|
||
class SELFRec(object): | ||
def __init__(self, config): | ||
self.social_data = [] | ||
self.feature_data = [] | ||
self.config = config | ||
self.training_data = FileIO.load_data_set(config['training.set'], config['model.type']) | ||
self.test_data = FileIO.load_data_set(config['test.set'], config['model.type']) | ||
self.dev_data = FileIO.load_data_set(config['dev.set'], config['model.type']) | ||
|
||
self.kwargs = {} | ||
if config.contain('social.data'): | ||
social_data = FileIO.load_social_data(self.config['social.data']) | ||
self.kwargs['social.data'] = social_data | ||
# if config.contains('feature.data'): | ||
# self.social_data = FileIO.loadFeature(config,self.config['feature.data']) | ||
print('Reading data and preprocessing...') | ||
|
||
def execute(self): | ||
# import the model module | ||
import_str = 'from model.' + self.config['model.type'] + '.' + self.config['model.name'] + ' import ' + self.config['model.name'] | ||
exec(import_str) # gqy: exec 执行储存在字符串或文件中的 Python 语句,相比于 eval,exec可以执行更复杂的 Python 代码 | ||
recommender = self.config['model.name'] + '(self.config,self.training_data,self.test_data,**self.kwargs)' | ||
recommender = self.config['model.name'] + '(self.config,self.training_data,self.test_data,self.dev_data,**self.kwargs)' | ||
eval(recommender).execute() # gqy:eval() 函数用来执行一个字符串表达式,并返回表达式的值。 |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,14 @@ | ||
training.set=./dataset/douban-book/train.txt | ||
test.set=./dataset/douban-book/test.txt | ||
social.data=./dataset/douban-book/trust.txt | ||
training.set=./dataset/retweet_prediction/train.txt | ||
test.set=./dataset/retweet_prediction/test.txt | ||
dev.set=./dataset/retweet_prediction/dev.txt | ||
social.data=./dataset/retweet_prediction/trust.txt | ||
model.name=MHCN | ||
model.type=graph | ||
item.ranking=-topN 10,20 | ||
item.ranking=-topN 100 | ||
embedding.size=64 | ||
num.max.epoch=30 | ||
batch_size=4096 | ||
learnRate=0.001 | ||
num.max.epoch=10 | ||
batch_size=256 | ||
learnRate=0.00001 | ||
reg.lambda=0.0001 | ||
MHCN=-n_layer 2 -ss_rate 0.01 | ||
output.setup=-dir ./results/ |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.