Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
book
提交
0116e793
B
book
项目概览
PaddlePaddle
/
book
通知
16
Star
4
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
40
列表
看板
标记
里程碑
合并请求
37
Wiki
5
Wiki
分析
仓库
DevOps
项目成员
Pages
B
book
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
40
Issue
40
列表
看板
标记
里程碑
合并请求
37
合并请求
37
Pages
分析
分析
仓库分析
DevOps
Wiki
5
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
0116e793
编写于
12月 05, 2018
作者:
L
lujun
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
ses-2,fix review for pr-649,update ploter,test=develop
上级
644a9d36
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
10 addition
and
10 deletion
+10
-10
02.recognize_digits/README.cn.md
02.recognize_digits/README.cn.md
+5
-5
02.recognize_digits/index.cn.html
02.recognize_digits/index.cn.html
+5
-5
未找到文件。
02.recognize_digits/README.cn.md
浏览文件 @
0116e793
...
@@ -302,9 +302,9 @@ def event_handler(pass_id, batch_id, cost):
...
@@ -302,9 +302,9 @@ def event_handler(pass_id, batch_id, cost):
```
python
```
python
from
paddle.v2.plot
import
Ploter
from
paddle.v2.plot
import
Ploter
train_
title
=
"Train cost"
train_
prompt
=
"Train cost"
test_
title
=
"Test cost"
test_
prompt
=
"Test cost"
cost_ploter
=
Ploter
(
train_
title
,
test_title
)
cost_ploter
=
Ploter
(
train_
prompt
,
test_prompt
)
# event_handler to plot a figure
# event_handler to plot a figure
def
event_handler_plot
(
ploter_title
,
step
,
cost
):
def
event_handler_plot
(
ploter_title
,
step
,
cost
):
...
@@ -376,7 +376,7 @@ for epoch_id in epochs:
...
@@ -376,7 +376,7 @@ for epoch_id in epochs:
fetch_list
=
[
avg_loss
,
acc
])
fetch_list
=
[
avg_loss
,
acc
])
if
step
%
100
==
0
:
if
step
%
100
==
0
:
print
(
"Pass %d, Batch %d, Cost %f"
%
(
step
,
epoch_id
,
metrics
[
0
]))
print
(
"Pass %d, Batch %d, Cost %f"
%
(
step
,
epoch_id
,
metrics
[
0
]))
event_handler_plot
(
train_
title
,
step
,
metrics
[
0
])
event_handler_plot
(
train_
prompt
,
step
,
metrics
[
0
])
step
+=
1
step
+=
1
# test for epoch
# test for epoch
...
@@ -385,7 +385,7 @@ for epoch_id in epochs:
...
@@ -385,7 +385,7 @@ for epoch_id in epochs:
train_test_feed
=
feeder
)
train_test_feed
=
feeder
)
print
(
"Test with Epoch %d, avg_cost: %s, acc: %s"
%
(
epoch_id
,
avg_loss_val
,
acc_val
))
print
(
"Test with Epoch %d, avg_cost: %s, acc: %s"
%
(
epoch_id
,
avg_loss_val
,
acc_val
))
event_handler_plot
(
test_
title
,
step
,
metrics
[
0
])
event_handler_plot
(
test_
prompt
,
step
,
metrics
[
0
])
lists
.
append
((
epoch_id
,
avg_loss_val
,
acc_val
))
lists
.
append
((
epoch_id
,
avg_loss_val
,
acc_val
))
if
save_dirname
is
not
None
:
if
save_dirname
is
not
None
:
...
...
02.recognize_digits/index.cn.html
浏览文件 @
0116e793
...
@@ -344,9 +344,9 @@ def event_handler(pass_id, batch_id, cost):
...
@@ -344,9 +344,9 @@ def event_handler(pass_id, batch_id, cost):
```python
```python
from paddle.v2.plot import Ploter
from paddle.v2.plot import Ploter
train_
title
= "Train cost"
train_
prompt
= "Train cost"
test_
title
= "Test cost"
test_
prompt
= "Test cost"
cost_ploter = Ploter(train_
title, test_title
)
cost_ploter = Ploter(train_
prompt, test_prompt
)
# event_handler to plot a figure
# event_handler to plot a figure
def event_handler_plot(ploter_title, step, cost):
def event_handler_plot(ploter_title, step, cost):
...
@@ -418,7 +418,7 @@ for epoch_id in epochs:
...
@@ -418,7 +418,7 @@ for epoch_id in epochs:
fetch_list=[avg_loss, acc])
fetch_list=[avg_loss, acc])
if step % 100 == 0:
if step % 100 == 0:
print("Pass %d, Batch %d, Cost %f" % (step, epoch_id, metrics[0]))
print("Pass %d, Batch %d, Cost %f" % (step, epoch_id, metrics[0]))
event_handler_plot(train_
title
, step, metrics[0])
event_handler_plot(train_
prompt
, step, metrics[0])
step += 1
step += 1
# test for epoch
# test for epoch
...
@@ -427,7 +427,7 @@ for epoch_id in epochs:
...
@@ -427,7 +427,7 @@ for epoch_id in epochs:
train_test_feed=feeder)
train_test_feed=feeder)
print("Test with Epoch %d, avg_cost: %s, acc: %s" %(epoch_id, avg_loss_val, acc_val))
print("Test with Epoch %d, avg_cost: %s, acc: %s" %(epoch_id, avg_loss_val, acc_val))
event_handler_plot(test_
title
, step, metrics[0])
event_handler_plot(test_
prompt
, step, metrics[0])
lists.append((epoch_id, avg_loss_val, acc_val))
lists.append((epoch_id, avg_loss_val, acc_val))
if save_dirname is not None:
if save_dirname is not None:
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录