Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
softwareprojektws17
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Steffen Knapp
softwareprojektws17
Commits
1a3d52cf
Commit
1a3d52cf
authored
7 years ago
by
schoenwandt
Browse files
Options
Downloads
Patches
Plain Diff
added eval_results.py to get the best scores for the evaluation measures
parent
779463df
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/eval_results.py
+55
-0
55 additions, 0 deletions
src/eval_results.py
with
55 additions
and
0 deletions
src/eval_results.py
0 → 100644
+
55
−
0
View file @
1a3d52cf
import
csv
from
operator
import
itemgetter
import
sys
"""
Returns the best evaluation scores for a
"
cv_results_*_*_*.csv
"
file
Needs the file name as command line argument
"""
def
replace
(
name
):
if
name
==
"
DecisionTreeClassifier
"
:
return
"
Tree
"
elif
name
==
"
LogisticRegression
"
:
return
"
LogR.
"
else
:
return
name
if
__name__
==
'
__main__
'
:
file
=
open
(
sys
.
argv
[
1
],
"
r
"
)
reader
=
csv
.
reader
(
file
)
results
=
[
x
for
x
in
reader
][
1
:]
sorted_by_acc
=
sorted
(
results
,
key
=
itemgetter
(
2
),
reverse
=
True
)
sorted_by_prec
=
sorted
(
results
,
key
=
itemgetter
(
3
),
reverse
=
True
)
sorted_by_rec
=
sorted
(
results
,
key
=
itemgetter
(
4
),
reverse
=
True
)
sorted_by_f1
=
sorted
(
results
,
key
=
itemgetter
(
5
),
reverse
=
True
)
print
(
"
Top 5 Accuracy:
"
)
for
i
in
range
(
5
):
print
(
"
{}
\t
{}
\t
{}
"
.
format
(
sorted_by_acc
[
i
][
2
],
replace
(
sorted_by_acc
[
i
][
0
]),
sorted_by_acc
[
i
][
1
]))
print
(
"
\n
Top 5 Precision:
"
)
for
i
in
range
(
5
):
print
(
"
{}
\t
{}
\t
{}
"
.
format
(
sorted_by_prec
[
i
][
3
],
replace
(
sorted_by_prec
[
i
][
0
]),
sorted_by_prec
[
i
][
1
]))
print
(
"
\n
Top 5 Recall:
"
)
for
i
in
range
(
5
):
print
(
"
{}
\t
{}
\t
{}
"
.
format
(
sorted_by_rec
[
i
][
4
],
replace
(
sorted_by_rec
[
i
][
0
]),
sorted_by_rec
[
i
][
1
]))
print
(
"
\n
Top 10 F1:
"
)
for
i
in
range
(
10
):
print
(
"
{}
\t
{}
\t
{}
"
.
format
(
sorted_by_f1
[
i
][
5
],
replace
(
sorted_by_f1
[
i
][
0
]),
sorted_by_f1
[
i
][
1
]))
features
=
sorted_by_f1
[
i
][
1
].
strip
(
"
[]
"
).
strip
().
split
(
"
,
"
)
print
(
"
\n
Top F1-scores without f7:
"
)
for
i
in
range
(
200
):
if
"
f7
"
not
in
sorted_by_f1
[
i
][
1
]
and
"
f4
"
not
in
sorted_by_f1
[
i
][
1
]:
print
(
"
{}
\t
{}
\t
{}
"
.
format
(
sorted_by_f1
[
i
][
5
],
replace
(
sorted_by_f1
[
i
][
0
]),
sorted_by_f1
[
i
][
1
]))
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment