Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
geopyck
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
geopyck
Commits
da045343
Commit
da045343
authored
1 year ago
by
Alice Brenon
Browse files
Options
Downloads
Patches
Plain Diff
Expose label-trimming logic as a separate module for reuse
parent
4babdc56
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
GEODE/Visualisation/ConfusionMatrix.py
+2
-11
2 additions, 11 deletions
GEODE/Visualisation/ConfusionMatrix.py
GEODE/Visualisation/__init__.py
+1
-0
1 addition, 0 deletions
GEODE/Visualisation/__init__.py
GEODE/__init__.py
+1
-1
1 addition, 1 deletion
GEODE/__init__.py
with
4 additions
and
12 deletions
GEODE/Visualisation/ConfusionMatrix.py
+
2
−
11
View file @
da045343
import
argparse
from
GEODE.Store
import
prepare
,
tabular
from
GEODE.Visualisation.Legend
import
trim
import
matplotlib.pyplot
as
plot
import
pandas
import
seaborn
from
sklearn.metrics
import
confusion_matrix
def
trim
(
name
,
maxSize
):
if
len
(
name
)
>
maxSize
:
components
=
name
.
split
(
'
'
)
return
components
[
0
]
+
'
[…]
'
else
:
return
name
def
trimLabels
(
labels
,
maxWidth
):
return
labels
if
maxWidth
is
None
else
[
trim
(
l
,
maxWidth
)
for
l
in
labels
]
def
heatmap
(
matrix
,
filePath
,
labels
,
**
kwargs
):
plot
.
figure
(
figsize
=
(
16
,
13
))
ax
=
seaborn
.
heatmap
(
...
...
@@ -46,7 +37,7 @@ def prepareData(data, labels=None):
def
drawConfusionMatrix
(
data
,
outputFile
,
labels
=
None
,
maxWidth
=
None
,
**
kwargs
):
truth
,
answers
,
labels
=
prepareData
(
data
,
labels
=
labels
)
matrix
=
confusion_matrix
(
truth
,
answers
,
labels
=
labels
,
normalize
=
'
true
'
)
heatmap
(
matrix
,
outputFile
,
trim
Labels
(
labels
,
maxWidth
),
**
kwargs
)
heatmap
(
matrix
,
outputFile
,
trim
(
labels
,
maxWidth
),
**
kwargs
)
def
getArgs
(
arguments
):
cli
=
argparse
.
ArgumentParser
(
...
...
This diff is collapsed.
Click to expand it.
GEODE/Visualisation/__init__.py
+
1
−
0
View file @
da045343
from
GEODE.Visualisation.ConfusionMatrix
import
drawConfusionMatrix
,
heatmap
from
GEODE.Visualisation.DensityProfile
import
densityProfile
,
drawDensityProfile
,
plotDensity
from
GEODE.Visualisation.Legend
import
trim
as
legend
This diff is collapsed.
Click to expand it.
GEODE/__init__.py
+
1
−
1
View file @
da045343
...
...
@@ -23,7 +23,7 @@ from GEODE.ENE import eneLabels
from
GEODE.Metadata
import
article
,
articleKey
,
paragraph
,
paragraphKey
,
\
fromKey
,
relativePath
,
toKey
,
uid
from
GEODE.Store
import
corpus
,
Directory
,
SelfContained
,
tabular
,
toTSV
from
GEODE.Visualisation
import
densityProfile
,
heatmap
from
GEODE.Visualisation
import
densityProfile
,
heatmap
,
legend
from
GEODE.Visualisation.ConfusionMatrix
import
drawConfusionMatrixCLI
from
GEODE.Visualisation.DensityProfile
import
drawDensityProfileCLI
...
...
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