Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
outillage
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
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
Alice Brenon
outillage
Commits
7ccb5f7e
Commit
7ccb5f7e
authored
1 year ago
by
Alice Brenon
Browse files
Options
Downloads
Patches
Plain Diff
Add a script to generate reports and draw a confusion matrix
parent
7ea8651f
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
scripts/ML/evaluate.py
+27
-0
27 additions, 0 deletions
scripts/ML/evaluate.py
with
27 additions
and
0 deletions
scripts/ML/evaluate.py
0 → 100755
+
27
−
0
View file @
7ccb5f7e
#!/usr/bin/env python3
from
EDdA.classification
import
heatmap
from
EDdA.store
import
preparePath
import
GEODE.discursive
as
discursive
import
pandas
from
sklearn.metrics
import
classification_report
,
confusion_matrix
from
sys
import
argv
def
evaluate
(
truth
,
predictions
,
outputDirectory
):
matrix
=
confusion_matrix
(
truth
,
predictions
,
labels
=
list
(
discursive
.
functions
),
normalize
=
'
true
'
)
heatmap
(
matrix
,
preparePath
(
f
"
{
outputDirectory
}
/confusion.png
"
),
labels
=
discursive
.
functions
)
with
open
(
f
"
{
outputDirectory
}
/report.json
"
,
'
w
'
)
as
json
:
print
(
classification_report
(
truth
,
predictions
,
output_dict
=
True
),
file
=
json
)
with
open
(
f
"
{
outputDirectory
}
/report.txt
"
,
'
w
'
)
as
txt
:
print
(
classification_report
(
truth
,
predictions
),
file
=
txt
)
if
__name__
==
'
__main__
'
:
truth
=
pandas
.
read_csv
(
argv
[
1
],
sep
=
'
\t
'
)
predictions
=
pandas
.
read_csv
(
argv
[
2
],
sep
=
'
\t
'
)
evaluate
(
truth
[
'
paragraphFunction
'
],
predictions
[
'
label
'
],
argv
[
3
])
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