Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleRec
提交
2cf8c6f0
P
PaddleRec
项目概览
PaddlePaddle
/
PaddleRec
通知
68
Star
12
Fork
5
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
27
列表
看板
标记
里程碑
合并请求
10
Wiki
1
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PaddleRec
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
27
Issue
27
列表
看板
标记
里程碑
合并请求
10
合并请求
10
Pages
分析
分析
仓库分析
DevOps
Wiki
1
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
2cf8c6f0
编写于
9月 28, 2020
作者:
Y
yinhaofeng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
adaptation windows
上级
99796045
变更
6
显示空白变更内容
内联
并排
Showing
6 changed file
with
49 addition
and
19 deletion
+49
-19
models/match/dssm/run.sh
models/match/dssm/run.sh
+1
-5
models/match/dssm/transform.py
models/match/dssm/transform.py
+14
-0
models/match/match-pyramid/eval.py
models/match/match-pyramid/eval.py
+15
-1
models/match/match-pyramid/run.sh
models/match/match-pyramid/run.sh
+1
-5
models/match/multiview-simnet/run.sh
models/match/multiview-simnet/run.sh
+2
-6
models/match/multiview-simnet/transform.py
models/match/multiview-simnet/transform.py
+16
-2
未找到文件。
models/match/dssm/run.sh
浏览文件 @
2cf8c6f0
...
...
@@ -13,11 +13,7 @@
# limitations under the License.
#!/bin/bash
echo
"................run................."
python
-m
paddlerec.run
-m
./config.yaml &> result1.txt
grep
-i
"query_doc_sim"
./result1.txt
>
./result2.txt
sed
'$d'
result2.txt
>
result.txt
rm
-f
result1.txt
rm
-f
result2.txt
python
-m
paddlerec.run
-m
./config.yaml &> result.txt
python transform.py
sort
-t
$'
\t
'
-k1
,1
-k
2nr,2 pair.txt
>
result.txt
rm
-f
pair.txt
...
...
models/match/dssm/transform.py
浏览文件 @
2cf8c6f0
...
...
@@ -16,6 +16,20 @@ import random
import
numpy
as
np
import
sklearn.metrics
filename
=
'./result.txt'
f
=
open
(
filename
,
"r"
)
lines
=
f
.
readlines
()
f
.
close
()
result
=
[]
for
line
in
lines
:
if
"query_doc_sim"
in
str
(
line
):
result
.
append
(
line
)
result
=
result
[:
-
1
]
f
=
open
(
filename
,
"w"
)
for
i
in
range
(
len
(
result
)):
f
.
write
(
str
(
result
[
i
]))
f
.
close
()
label
=
[]
filename
=
'./data/label.txt'
f
=
open
(
filename
,
"r"
)
...
...
models/match/match-pyramid/eval.py
浏览文件 @
2cf8c6f0
...
...
@@ -32,6 +32,20 @@ def eval_MAP(pred, gt):
return
map_value
/
r
filename
=
'./result.txt'
f
=
open
(
filename
,
"r"
)
lines
=
f
.
readlines
()
f
.
close
()
result
=
[]
for
line
in
lines
:
if
"prediction"
in
str
(
line
):
result
.
append
(
line
)
result
=
result
[:
-
1
]
f
=
open
(
filename
,
"w"
)
for
i
in
range
(
len
(
result
)):
f
.
write
(
str
(
result
[
i
]))
f
.
close
()
filename
=
'./data/relation.test.fold1.txt'
gt
=
[]
qid
=
[]
...
...
@@ -56,7 +70,7 @@ for line in open(filename):
pred
.
append
(
float
(
line
))
result_dict
=
{}
for
i
in
range
(
len
(
qi
d
)):
for
i
in
range
(
len
(
pre
d
)):
if
qid
[
i
]
not
in
result_dict
:
result_dict
[
qid
[
i
]]
=
[]
result_dict
[
qid
[
i
]].
append
([
gt
[
i
],
pred
[
i
]])
...
...
models/match/match-pyramid/run.sh
浏览文件 @
2cf8c6f0
#!/bin/bash
echo
"................run................."
python
-m
paddlerec.run
-m
./config.yaml &>result1.txt
grep
-i
"prediction"
./result1.txt
>
./result2.txt
sed
'$d'
result2.txt
>
result.txt
rm
-f
result2.txt
rm
-f
result1.txt
python
-m
paddlerec.run
-m
./config.yaml &>result.txt
python eval.py
models/match/multiview-simnet/run.sh
浏览文件 @
2cf8c6f0
...
...
@@ -14,12 +14,8 @@
#!/bin/bash
echo
"................run................."
python
-m
paddlerec.run
-m
./config.yaml &>result1.txt
grep
-i
"query_pt_sim"
./result1.txt
>
./result2.txt
sed
'$d'
result2.txt
>
result.txt
rm
-f
result1.txt
rm
-f
result2.txt
python
-m
paddlerec.run
-m
./config.yaml &>result.txt
python transform.py
sort
-t
$'
\t
'
-k1
,1
-k
2nr,2 pair.txt
>
result.txt
sort
-t
$'
\t
'
-k1
,1
-k
2nr,2 pair.txt
&
>result.txt
rm
-f
pair.txt
python ../../../tools/cal_pos_neg.py result.txt
models/match/multiview-simnet/transform.py
浏览文件 @
2cf8c6f0
...
...
@@ -15,6 +15,20 @@
import
random
import
numpy
as
np
filename
=
'./result.txt'
f
=
open
(
filename
,
"r"
)
lines
=
f
.
readlines
()
f
.
close
()
result
=
[]
for
line
in
lines
:
if
"query_pt_sim"
in
str
(
line
):
result
.
append
(
line
)
result
=
result
[:
-
1
]
f
=
open
(
filename
,
"w"
)
for
i
in
range
(
len
(
result
)):
f
.
write
(
str
(
result
[
i
]))
f
.
close
()
label
=
[]
filename
=
'./data/label.txt'
f
=
open
(
filename
,
"r"
)
...
...
@@ -31,7 +45,7 @@ filename = './result.txt'
sim
=
[]
for
line
in
open
(
filename
):
line
=
line
.
strip
().
split
(
","
)
print
(
line
)
#
print(line)
line
[
3
]
=
line
[
3
].
split
(
":"
)
line
=
line
[
3
][
1
].
strip
(
" "
)
line
=
line
.
strip
(
"["
)
...
...
@@ -50,6 +64,6 @@ f.close()
filename
=
'pair.txt'
f
=
open
(
filename
,
"w"
)
for
i
in
range
(
len
(
sim
)):
print
(
i
)
#
print(i)
f
.
write
(
str
(
query
[
i
])
+
"
\t
"
+
str
(
sim
[
i
])
+
"
\t
"
+
str
(
label
[
i
])
+
"
\n
"
)
f
.
close
()
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录