Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
BaiXuePrincess
PaddleRec
提交
ded22807
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看板
提交
ded22807
编写于
5月 18, 2020
作者:
T
tangwei
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
rebase user
上级
c17f9aea
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
24 addition
and
11 deletion
+24
-11
models/contentunderstanding/classification/config.yaml
models/contentunderstanding/classification/config.yaml
+1
-1
models/contentunderstanding/classification/model.py
models/contentunderstanding/classification/model.py
+13
-9
models/contentunderstanding/readme.md
models/contentunderstanding/readme.md
+10
-1
未找到文件。
models/contentunderstanding/classification/config.yaml
浏览文件 @
ded22807
...
...
@@ -18,7 +18,7 @@ train:
strategy
:
"
async"
epochs
:
10
workspace
:
"
paddlerec.models.
rank.text_
classification"
workspace
:
"
paddlerec.models.
contentunderstandin.
classification"
reader
:
batch_size
:
5
...
...
models/contentunderstanding/classification/model.py
浏览文件 @
ded22807
...
...
@@ -26,29 +26,35 @@ import paddle.fluid.layers.control_flow as cf
class
Model
(
ModelBase
):
def
__init__
(
self
,
config
):
ModelBase
.
__init__
(
self
,
config
)
self
.
dict_dim
=
100
self
.
max_len
=
10
self
.
cnn_dim
=
32
self
.
cnn_filter_size
=
128
self
.
emb_dim
=
8
self
.
hid_dim
=
128
self
.
class_dim
=
2
def
train_net
(
self
):
""" network definition """
data
=
fluid
.
data
(
name
=
"input"
,
shape
=
[
None
,
max_len
],
dtype
=
'int64'
)
data
=
fluid
.
data
(
name
=
"input"
,
shape
=
[
None
,
self
.
max_len
],
dtype
=
'int64'
)
label
=
fluid
.
data
(
name
=
"label"
,
shape
=
[
None
,
1
],
dtype
=
'int64'
)
seq_len
=
fluid
.
data
(
name
=
"seq_len"
,
shape
=
[
None
],
dtype
=
'int64'
)
# embedding layer
emb
=
fluid
.
embedding
(
input
=
data
,
size
=
[
dict_dim
,
emb_dim
])
emb
=
fluid
.
layers
.
sequence_unpad
(
emb
,
length
=
seq_len
)
emb
=
fluid
.
embedding
(
input
=
data
,
size
=
[
self
.
dict_dim
,
self
.
emb_dim
])
emb
=
fluid
.
layers
.
sequence_unpad
(
emb
,
length
=
se
lf
.
se
q_len
)
# convolution layer
conv
=
fluid
.
nets
.
sequence_conv_pool
(
input
=
emb
,
num_filters
=
cnn_dim
,
filter_size
=
cnn_filter_size
,
num_filters
=
self
.
cnn_dim
,
filter_size
=
self
.
cnn_filter_size
,
act
=
"tanh"
,
pool_type
=
"max"
)
# full connect layer
fc_1
=
fluid
.
layers
.
fc
(
input
=
[
conv
],
size
=
hid_dim
)
# softmax layer
prediction
=
fluid
.
layers
.
fc
(
input
=
[
fc_1
],
size
=
class_dim
,
act
=
"softmax"
)
prediction
=
fluid
.
layers
.
fc
(
input
=
[
fc_1
],
size
=
self
.
class_dim
,
act
=
"softmax"
)
cost
=
fluid
.
layers
.
cross_entropy
(
input
=
prediction
,
label
=
label
)
avg_cost
=
fluid
.
layers
.
mean
(
x
=
cost
)
acc
=
fluid
.
layers
.
accuracy
(
input
=
prediction
,
label
=
label
)
...
...
@@ -65,9 +71,7 @@ class Model(ModelBase):
def
optimizer
(
self
):
learning_rate
=
0.01
sgd_optimizer
=
fluid
.
optimizer
.
Adagrad
(
learning_rate
=
learning_rate
)
return
sgd_optimizer
def
infer_net
(
self
,
parameter_list
):
self
.
train_net
()
models/contentunderstanding/readme.md
浏览文件 @
ded22807
...
...
@@ -69,14 +69,23 @@ python text2paddle.py raw_big_train_data/ raw_big_test_data/ train_big_data test
无
### 训练
```
python -m paddlerec.run -m paddlerec.models.rank.dnn -d cpu -e single
```
### 预测
```
python -m paddlerec.run -m paddlerec.models.rank.dnn -d cpu -e single
```
## 效果对比
### 模型效果 (测试)
| 数据集 | 模型 | loss | auc | acc | mae |
| :------------------: | :--------------------: | :---------: |:---------: | :---------: |:---------: |
|
--
| TagSpace | -- | -- | -- | -- |
|
ag news dataset
| TagSpace | -- | -- | -- | -- |
| -- | Classification | -- | -- | -- | -- |
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录