Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
沈秋雨
/
lyric_rhyme
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
Commit
d0592b22
...
d0592b22804d997f55b1df9b92894cc4ddfb7d24
authored
2026-06-27 13:17:42 +0800
by
沈秋雨
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
优化fix脚本
1 parent
cddc9bdd
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
7 deletions
results/fix_same_singer_samples.py
results/fix_same_singer_samples.py
View file @
d0592b2
...
...
@@ -69,17 +69,18 @@ def should_remove(row: dict, main_durations: dict[str, float], threshold: float)
def
compute_summary
(
rows
:
list
[
dict
],
threshold
:
float
,
out_path
:
str
)
->
dict
:
"""计算评测指标。"""
tp
=
fp
=
tn
=
fn
=
0
upload_ms
=
poll_ms
=
total_ms
=
[]
upload_ms
,
poll_ms
,
total_ms
=
[],
[],
[]
by_variant
:
dict
[
str
,
dict
]
=
{}
for
r
in
rows
:
pred
=
r
.
get
(
"predicted_duplicate"
,
""
)
.
lower
()
==
"true"
exp
=
r
.
get
(
"expected_duplicate"
,
""
)
.
lower
()
==
"true"
correct
=
r
.
get
(
"correct"
,
""
)
.
lower
()
==
"true"
sample_class
=
r
.
get
(
"sample_class"
,
"unknown"
)
variant
=
r
.
get
(
"variant"
,
"unknown"
)
if
variant
not
in
by_variant
:
by_variant
[
variant
]
=
{
"correct"
:
0
,
"total"
:
0
}
by_variant
[
variant
]
=
{
"correct"
:
0
,
"total"
:
0
,
"sample_class"
:
sample_class
}
by_variant
[
variant
][
"total"
]
+=
1
if
correct
:
by_variant
[
variant
][
"correct"
]
+=
1
...
...
@@ -137,8 +138,22 @@ def compute_summary(rows: list[dict], threshold: float, out_path: str) -> dict:
"query_time_ms"
:
_stats
(
total_ms
),
"upload_time_ms"
:
_stats
(
upload_ms
),
"poll_time_ms"
:
_stats
(
poll_ms
),
"by_sample_class"
:
{
cls
:
{
"by_variant"
:
{
v
:
{
"accuracy"
:
round
(
d
[
"correct"
]
/
d
[
"total"
],
4
),
"total"
:
d
[
"total"
]}
for
v
,
d
in
sorted
(
by_variant
.
items
())
if
d
[
"sample_class"
]
==
cls
}
}
for
cls
in
(
"positive"
,
"negative"
)
},
"by_variant"
:
{
v
:
{
"accuracy"
:
round
(
d
[
"correct"
]
/
d
[
"total"
],
4
),
"total"
:
d
[
"total"
]}
v
:
{
"sample_class"
:
d
[
"sample_class"
],
"accuracy"
:
round
(
d
[
"correct"
]
/
d
[
"total"
],
4
),
"total"
:
d
[
"total"
],
}
for
v
,
d
in
sorted
(
by_variant
.
items
())
},
"out"
:
out_path
,
...
...
@@ -237,10 +252,14 @@ def main():
print
(
f
"Recall: {summary['recall']}"
)
print
(
f
"F1: {summary['f1']}"
)
print
(
f
"TP={summary['tp']} FP={summary['fp']} TN={summary['tn']} FN={summary['fn']}"
)
print
()
print
(
"按变体:"
)
for
v
,
d
in
summary
[
"by_variant"
]
.
items
():
print
(
f
" {v:20s} acc={d['accuracy']:.4f} n={d['total']}"
)
for
cls
in
(
"positive"
,
"negative"
):
variants
=
summary
[
"by_sample_class"
][
cls
][
"by_variant"
]
if
not
variants
:
continue
print
(
f
"
\n
[{cls}]"
)
for
v
,
d
in
variants
.
items
():
print
(
f
" {v:20s} acc={d['accuracy']:.4f} n={d['total']}"
)
# 打印被移除的样本明细
if
removed
:
...
...
Please
register
or
sign in
to post a comment