提交 bcea8931 编写于 作者: D dongdaxiang

fix some typo

上级 5ca633da
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
## Introduction ## Introduction
In news recommendation scenarios, different from traditional systems that recommend entertainment items such as movies or music, there are several new problems to solve. In news recommendation scenarios, different from traditional systems that recommend entertainment items such as movies or music, there are several new problems to solve.
- Very sparse user profile features exist that a user may login a news recommendation app anonymously and a user is likely to read a fresh news item. - Very sparse user profile features exist that a user may login a news recommendation app anonymously and a user is likely to read a fresh news item.
- News are generated or disappeared very fast compare with movies or music. Usually, there will be thousands of news generated in a news recommendation app. The Consumption of news is also fast since users care about newly happenned things. - News are generated or disappeared very fast compare with movies or musics. Usually, there will be thousands of news generated in a news recommendation app. The Consumption of news is also fast since users care about newly happened things.
- User interests may change frequently in the news recommendation setting. The content of news will affect users' reading behaviors a lot even the category of the news does not belong to users' long-term interest. In news recommendation, reading behaviors are determined by both short-term interest and long-term interest of users. - User interests may change frequently in the news recommendation setting. The content of news will affect users' reading behaviors a lot even the category of the news does not belong to users' long-term interest. In news recommendation, reading behaviors are determined by both short-term interest and long-term interest of users.
[GRU4Rec](https://github.com/PaddlePaddle/models/tree/develop/fluid/PaddleRec/gru4rec) models a user's short-term and long-term interest by applying a gated-recurrent-unit on the user's reading history. The generalization ability of recurrent neural network captures users' similarity of reading sequences that alleviates the user profile sparsity problem. However, the paper of GRU4Rec operates on close domain of items that the model predicts which item a user will be interested in through classification method. In news recommendation, news items are dynamic through time that GRU4Rec model can not predict items that do not exist in training dataset. [GRU4Rec](https://github.com/PaddlePaddle/models/tree/develop/fluid/PaddleRec/gru4rec) models a user's short-term and long-term interest by applying a gated-recurrent-unit on the user's reading history. The generalization ability of recurrent neural network captures users' similarity of reading sequences that alleviates the user profile sparsity problem. However, the paper of GRU4Rec operates on close domain of items that the model predicts which item a user will be interested in through classification method. In news recommendation, news items are dynamic through time that GRU4Rec model can not predict items that do not exist in training dataset.
...@@ -16,9 +16,14 @@ Sequence Semantic Retrieval(SSR) Model shares the similar idea with Multi-Rate D ...@@ -16,9 +16,14 @@ Sequence Semantic Retrieval(SSR) Model shares the similar idea with Multi-Rate D
Dataset preprocessing follows the method of [GRU4Rec Project](https://github.com/PaddlePaddle/models/tree/develop/fluid/PaddleRec/gru4rec). Note that you should reuse scripts from GRU4Rec project for data preprocessing. Dataset preprocessing follows the method of [GRU4Rec Project](https://github.com/PaddlePaddle/models/tree/develop/fluid/PaddleRec/gru4rec). Note that you should reuse scripts from GRU4Rec project for data preprocessing.
## Training ## Training
Before training, you should set PYTHONPATH environment
```
export PYTHONPATH=./models/fluid:$PYTHONPATH
```
The command line options for training can be listed by `python train.py -h` The command line options for training can be listed by `python train.py -h`
``` bash ``` bash
fluid train.py --train_file rsc15_train_tr_paddle.txt python train.py --train_file rsc15_train_tr_paddle.txt
``` ```
## Build Index ## Build Index
......
...@@ -17,10 +17,9 @@ import paddle.fluid.layers.nn as nn ...@@ -17,10 +17,9 @@ import paddle.fluid.layers.nn as nn
import paddle.fluid.layers.tensor as tensor import paddle.fluid.layers.tensor as tensor
import paddle.fluid.layers.control_flow as cf import paddle.fluid.layers.control_flow as cf
import paddle.fluid.layers.io as io import paddle.fluid.layers.io as io
from PaddleRec.multiview_simnet.nets import BowEncoder from PaddleRec.multiview_simnet.nets import BowEncoder
from PaddleRec.multiview_simnet.nets import GrnnEncoder from PaddleRec.multiview_simnet.nets import GrnnEncoder
from PaddleRec.multiview_simnet.nets import MultiviewSimnet
class PairwiseHingeLoss(object): class PairwiseHingeLoss(object):
def __init__(self, margin=0.8): def __init__(self, margin=0.8):
...@@ -97,5 +96,6 @@ class SequenceSemanticRetrieval(object): ...@@ -97,5 +96,6 @@ class SequenceSemanticRetrieval(object):
hinge_loss = self.pairwise_hinge_loss.forward(cos_pos, cos_neg) hinge_loss = self.pairwise_hinge_loss.forward(cos_pos, cos_neg)
avg_cost = nn.mean(hinge_loss) avg_cost = nn.mean(hinge_loss)
correct = self.get_correct(cos_neg, cos_pos) correct = self.get_correct(cos_neg, cos_pos)
return [user_data, pos_item_data, neg_item_data], \ return [user_data, pos_item_data, neg_item_data], \
pos_item_hid, neg_item_hid, avg_cost, correct pos_item_hid, neg_item_hid, avg_cost, correct
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册