`feeding` is devoted to specify the correspondence between each yield record and `paddle.layer.data`. For instance, the first column of data generated by `movielens.train` corresponds to `user_id` feature.
fromIPythonimportdisplay
importcPickle
```python
feeding={
feeding={
'user_id':0,
'user_id':0,
'gender_id':1,
'gender_id':1,
...
@@ -312,12 +310,11 @@ feeding = {
...
@@ -312,12 +310,11 @@ feeding = {
'movie_title':6,
'movie_title':6,
'score':7
'score':7
}
}
```
step=0
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.
train_costs=[],[]
test_costs=[],[]
```python
defevent_handler(event):
defevent_handler(event):
globalstep
globalstep
globaltrain_costs
globaltrain_costs
...
@@ -342,15 +339,27 @@ def event_handler(event):
...
@@ -342,15 +339,27 @@ def event_handler(event):
display.display(plt.gcf())
display.display(plt.gcf())
plt.gcf().clear()
plt.gcf().clear()
step+=1
step+=1
```
Finally, we can invoke `trainer.train` to start training: