Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
models
提交
a58b30c6
M
models
项目概览
PaddlePaddle
/
models
大约 1 年 前同步成功
通知
222
Star
6828
Fork
2962
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
602
列表
看板
标记
里程碑
合并请求
255
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
M
models
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
602
Issue
602
列表
看板
标记
里程碑
合并请求
255
合并请求
255
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
a58b30c6
编写于
12月 13, 2019
作者:
Z
zhoushiyu
提交者:
Thunderbrook
12月 13, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[PaddleRec] fix Nan loss and hash problem in dnn model (#4067)
* fix paddlerec dnn loss nan * change hash with mmh3.hash in dnn
上级
d1c74b39
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
9 addition
and
4 deletion
+9
-4
PaddleRec/ctr/dnn/network_conf.py
PaddleRec/ctr/dnn/network_conf.py
+3
-3
PaddleRec/ctr/dnn/reader.py
PaddleRec/ctr/dnn/reader.py
+5
-1
PaddleRec/ctr/dnn/requirements.txt
PaddleRec/ctr/dnn/requirements.txt
+1
-0
未找到文件。
PaddleRec/ctr/dnn/network_conf.py
浏览文件 @
a58b30c6
...
@@ -201,13 +201,13 @@ def ctr_dnn_model(embedding_size, sparse_feature_dim, use_py_reader=True):
...
@@ -201,13 +201,13 @@ def ctr_dnn_model(embedding_size, sparse_feature_dim, use_py_reader=True):
initializer
=
fluid
.
initializer
.
Normal
(
initializer
=
fluid
.
initializer
.
Normal
(
scale
=
1
/
math
.
sqrt
(
fc2
.
shape
[
1
]))))
scale
=
1
/
math
.
sqrt
(
fc2
.
shape
[
1
]))))
predict
=
fluid
.
layers
.
fc
(
input
=
fc3
,
predict
=
fluid
.
layers
.
fc
(
input
=
fc3
,
size
=
2
,
size
=
1
,
act
=
's
oftmax
'
,
act
=
's
igmoid
'
,
param_attr
=
fluid
.
ParamAttr
(
param_attr
=
fluid
.
ParamAttr
(
initializer
=
fluid
.
initializer
.
Normal
(
initializer
=
fluid
.
initializer
.
Normal
(
scale
=
1
/
math
.
sqrt
(
fc3
.
shape
[
1
]))))
scale
=
1
/
math
.
sqrt
(
fc3
.
shape
[
1
]))))
cost
=
fluid
.
layers
.
cross_entropy
(
input
=
predict
,
label
=
words
[
-
1
]
)
cost
=
fluid
.
layers
.
log_loss
(
input
=
predict
,
label
=
fluid
.
layers
.
cast
(
words
[
-
1
],
dtype
=
"float32"
)
)
avg_cost
=
fluid
.
layers
.
reduce_sum
(
cost
)
avg_cost
=
fluid
.
layers
.
reduce_sum
(
cost
)
accuracy
=
fluid
.
layers
.
accuracy
(
input
=
predict
,
label
=
words
[
-
1
])
accuracy
=
fluid
.
layers
.
accuracy
(
input
=
predict
,
label
=
words
[
-
1
])
auc_var
,
batch_auc_var
,
auc_states
=
\
auc_var
,
batch_auc_var
,
auc_states
=
\
...
...
PaddleRec/ctr/dnn/reader.py
浏览文件 @
a58b30c6
import
mmh3
class
Dataset
:
class
Dataset
:
def
__init__
(
self
):
def
__init__
(
self
):
pass
pass
...
@@ -43,7 +46,8 @@ class CriteoDataset(Dataset):
...
@@ -43,7 +46,8 @@ class CriteoDataset(Dataset):
self
.
cont_diff_
[
idx
-
1
])
self
.
cont_diff_
[
idx
-
1
])
for
idx
in
self
.
categorical_range_
:
for
idx
in
self
.
categorical_range_
:
sparse_feature
.
append
([
sparse_feature
.
append
([
hash
(
str
(
idx
)
+
features
[
idx
])
%
self
.
hash_dim_
mmh3
.
hash
(
str
(
idx
)
+
features
[
idx
])
%
self
.
hash_dim_
])
])
label
=
[
int
(
features
[
0
])]
label
=
[
int
(
features
[
0
])]
...
...
PaddleRec/ctr/dnn/requirements.txt
浏览文件 @
a58b30c6
click
click
mmh3
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录