提交 c7d259e1 编写于 作者: Y Yu Yang

Merge develop

上级 9275d53c
...@@ -72,7 +72,7 @@ def main(): ...@@ -72,7 +72,7 @@ def main():
parameters=parameters, parameters=parameters,
update_equation=paddle.optimizer.Adam( update_equation=paddle.optimizer.Adam(
learning_rate=1e-4)) learning_rate=1e-4))
reader_dict = { feeding = {
'user_id': 0, 'user_id': 0,
'gender_id': 1, 'gender_id': 1,
'age_id': 2, 'age_id': 2,
...@@ -90,14 +90,12 @@ def main(): ...@@ -90,14 +90,12 @@ def main():
event.pass_id, event.batch_id, event.cost) event.pass_id, event.batch_id, event.cost)
trainer.train( trainer.train(
reader=paddle.reader.batched( reader=paddle.batch(
paddle.reader.firstn( paddle.reader.shuffle(
paddle.reader.shuffle( paddle.dataset.movielens.train(), buf_size=8192),
paddle.dataset.movielens.train(), buf_size=8192),
n=1000),
batch_size=256), batch_size=256),
event_handler=event_handler, event_handler=event_handler,
reader_dict=reader_dict, feeding=feeding,
num_passes=1) num_passes=1)
user_id = 234 user_id = 234
...@@ -111,17 +109,16 @@ def main(): ...@@ -111,17 +109,16 @@ def main():
def reader(): def reader():
yield feature yield feature
infer_dict = copy.copy(reader_dict) infer_dict = copy.copy(feeding)
del infer_dict['score'] del infer_dict['score']
print infer_dict
prediction = paddle.infer( prediction = paddle.infer(
output=inference, output=inference,
parameters=parameters, parameters=parameters,
reader=paddle.reader.batched( reader=paddle.batch(
reader, batch_size=32), reader, batch_size=32),
reader_dict=infer_dict) feeding=infer_dict)
print prediction print(prediction + 5) / 2
if __name__ == '__main__': if __name__ == '__main__':
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册