Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
BaiXuePrincess
PaddleRec
提交
405ec7ed
P
PaddleRec
项目概览
BaiXuePrincess
/
PaddleRec
与 Fork 源项目一致
Fork自
PaddlePaddle / PaddleRec
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PaddleRec
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
405ec7ed
编写于
4月 09, 2020
作者:
T
tangwei12
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add ctr metrics
上级
cccc61c0
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
14 addition
and
9 deletion
+14
-9
models/ctr_dnn/model.py
models/ctr_dnn/model.py
+6
-0
trainer/single_train.py
trainer/single_train.py
+7
-8
utils/envs.py
utils/envs.py
+1
-1
未找到文件。
models/ctr_dnn/model.py
浏览文件 @
405ec7ed
...
...
@@ -124,6 +124,12 @@ class Train(object):
return
self
.
metrics
def
metric_extras
(
self
):
self
.
metric_vars
=
[
self
.
metrics
[
0
]]
self
.
metric_alias
=
[
"AUC"
]
self
.
fetch_interval_batchs
=
10
return
(
self
.
metric_vars
,
self
.
metric_alias
,
self
.
fetch_interval_batchs
)
def
optimizer
(
self
):
learning_rate
=
envs
.
get_global_env
(
"hyper_parameters.learning_rate"
,
None
,
self
.
namespace
)
optimizer
=
fluid
.
optimizer
.
Adam
(
learning_rate
,
lazy_mode
=
True
)
...
...
trainer/single_train.py
浏览文件 @
405ec7ed
...
...
@@ -65,6 +65,7 @@ class SingleTrainer(Trainer):
self
.
model
.
input
()
self
.
model
.
net
()
self
.
metrics
=
self
.
model
.
metrics
()
self
.
metric_extras
=
self
.
model
.
metric_extras
()
loss
=
self
.
model
.
avg_loss
()
optimizer
=
self
.
model
.
optimizer
()
...
...
@@ -80,10 +81,10 @@ class SingleTrainer(Trainer):
context
[
'is_exit'
]
=
True
def
infer
(
self
,
context
):
print
(
"Need to be implement"
)
context
[
'is_exit'
]
=
True
def
terminal
(
self
,
context
):
print
(
"clean up and exit"
)
context
[
'is_exit'
]
=
True
...
...
@@ -162,16 +163,14 @@ class SingleTrainerWithDataset(SingleTrainer):
epochs
=
envs
.
get_global_env
(
"train.epochs"
)
print
(
"fetch_list: {}"
.
format
(
len
(
self
.
metrics
)))
for
i
in
range
(
epochs
):
self
.
exe
.
train_from_dataset
(
program
=
fluid
.
default_main_program
(),
dataset
=
dataset
,
fetch_list
=
self
.
metric
s
,
fetch_info
=
[
"auc "
,
"batch auc"
],
print_period
=
1
)
fetch_list
=
self
.
metric
_extras
[
0
]
,
fetch_info
=
self
.
metric_extras
[
1
],
print_period
=
self
.
metric_extras
[
2
]
)
context
[
'status'
]
=
'infer_pass'
def
infer
(
self
,
context
):
def
infer
(
self
,
context
):
context
[
'status'
]
=
'terminal_pass'
utils/envs.py
浏览文件 @
405ec7ed
...
...
@@ -53,7 +53,7 @@ def pretty_print_envs():
max_k
=
max
(
max_k
,
len
(
k
))
max_v
=
max
(
max_v
,
len
(
str
(
v
)))
h_format
=
"{{:^{}s}}{
{:<{}s}}
\n
"
.
format
(
max_k
,
max_v
)
h_format
=
"{{:^{}s}}{
}{{:<{}s}}
\n
"
.
format
(
max_k
,
" "
*
spacing
,
max_v
)
l_format
=
"{{:<{}s}}{{}}{{:<{}s}}
\n
"
.
format
(
max_k
,
max_v
)
length
=
max_k
+
max_v
+
spacing
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录