@@ -163,7 +163,7 @@ print "User %s rates Movie %s with Score %s"%(user_info[uid], movie_info[mov_id]
User <UserInfo id(1), gender(F), age(1), job(10)> rates Movie <MovieInfo id(1193), title(One Flew Over the Cuckoo's Nest), categories(['Drama'])> with Score [5.0]
```
User 1 gave movie `1193` a rating of 5.
The output shows that user 1 gave movie `1193` a rating of 5.
After issuing a command `python train.py`, trainning is starting immediately! The details will be unpacked by the following sessions to see how it works.
...
...
@@ -174,7 +174,14 @@ After issuing a command `python train.py`, trainning is starting immediately! Th
First, we must import and initialize PaddlePaddle (enable/disable GPU, set the number of trainers, etc).
The movie ID and the movie type are mapped to their corresponding hidden layers. For movie's title, a sequence of words represented by an ID sequence, the sequence feature of time window will be obtained after the convolution layer, and then sampling to obtain specific dimension features. The entire process is implemented in `text_conv_pool`.
First we define the model parameters according to the previous model configuration `cost`.
First, we define the model parameters according to the previous model configuration `cost`.
```python
# Create parameters
...
...
@@ -315,6 +319,11 @@ feeding = {
Callback function `event_handler` is used to track training and testing process that might be triggered once the action to which it is attached is executed.
```python
step=0
train_costs=[],[]
test_costs=[],[]
defevent_handler(event):
globalstep
globaltrain_costs
...
...
@@ -344,17 +353,6 @@ def event_handler(event):
Finally, we can invoke `trainer.train` to start training: