提交 072c8c29 编写于 作者: L lujun

ses-5,fix review for pr-647,update ploter,test=develop

上级 7dc64b24
......@@ -408,11 +408,6 @@ test_reader = paddle.batch(
### 构造训练过程(trainer)
我们这里构造了一个训练过程,包括训练优化函数。
```python
trainer = Trainer(
train_func=train_program, place=place, optimizer_func=optimizer_func)
```
### 提供数据
`feed_order`用来定义每条产生的数据和`paddle.layer.data`之间的映射关系。比如,`movielens.train`产生的第一列的数据对应的是`user_id`这个特征。
......@@ -462,9 +457,9 @@ def train_test(program, reader):
# Specify the directory path to save the parameters
params_dirname = "recommender_system.inference.model"
from paddle.v2.plot import Ploter
test_title = "Test cost"
plot_cost = Ploter(test_title)
from paddle.utils.plot import Ploter
test_prompt = "Test cost"
plot_cost = Ploter(test_prompt)
def train_loop():
feed_list = [
......@@ -485,7 +480,7 @@ def train_loop():
# get test avg_cost
test_avg_cost = np.array(avg_cost_set).mean()
plot_cost.append(test_title, batch_id, outs[0])
plot_cost.append(test_prompt, batch_id, outs[0])
plot_cost.plot()
print("avg_cost: %s" % test_avg_cost)
......
......@@ -450,11 +450,6 @@ test_reader = paddle.batch(
### 构造训练过程(trainer)
我们这里构造了一个训练过程,包括训练优化函数。
```python
trainer = Trainer(
train_func=train_program, place=place, optimizer_func=optimizer_func)
```
### 提供数据
`feed_order`用来定义每条产生的数据和`paddle.layer.data`之间的映射关系。比如,`movielens.train`产生的第一列的数据对应的是`user_id`这个特征。
......@@ -504,9 +499,9 @@ def train_test(program, reader):
# Specify the directory path to save the parameters
params_dirname = "recommender_system.inference.model"
from paddle.v2.plot import Ploter
test_title = "Test cost"
plot_cost = Ploter(test_title)
from paddle.utils.plot import Ploter
test_prompt = "Test cost"
plot_cost = Ploter(test_prompt)
def train_loop():
feed_list = [
......@@ -527,7 +522,7 @@ def train_loop():
# get test avg_cost
test_avg_cost = np.array(avg_cost_set).mean()
plot_cost.append(test_title, batch_id, outs[0])
plot_cost.append(test_prompt, batch_id, outs[0])
plot_cost.plot()
print("avg_cost: %s" % test_avg_cost)
......
......@@ -215,8 +215,8 @@ def train(use_cuda, params_dirname):
test_avg_cost = np.array(avg_cost_set).mean()
print("avg_cost: %s" % test_avg_cost)
if test_avg_cost < 4.0: # Change this number to adjust accuracy
#if batch_id == 20:
# if test_avg_cost < 4.0: # Change this number to adjust accuracy
if batch_id == 20:
if params_dirname is not None:
fluid.io.save_inference_model(params_dirname, [
"user_id", "gender_id", "age_id", "job_id",
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册