Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
MLAir
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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
esde
machine-learning
MLAir
Commits
8a750632
Commit
8a750632
authored
Feb 4, 2021
by
leufen1
Browse files
Options
Downloads
Patches
Plain Diff
create detailed and reduced competitive skill score plots, /close
#131
parent
0efbc11a
No related branches found
No related tags found
3 merge requests
!253
include current develop
,
!252
Resolve "release v1.3.0"
,
!232
Resolve "Make IntelliO3-ts v1.0 available as reference"
Pipeline
#58962
passed
Feb 4, 2021
Stage: test
Stage: docs
Stage: pages
Stage: deploy
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
mlair/plotting/postprocessing_plotting.py
+28
-10
28 additions, 10 deletions
mlair/plotting/postprocessing_plotting.py
with
28 additions
and
10 deletions
mlair/plotting/postprocessing_plotting.py
+
28
−
10
View file @
8a750632
...
@@ -701,12 +701,23 @@ class PlotCompetitiveSkillScore(AbstractPlotClass):
...
@@ -701,12 +701,23 @@ class PlotCompetitiveSkillScore(AbstractPlotClass):
self
.
_model_setup
=
model_setup
self
.
_model_setup
=
model_setup
self
.
_labels
=
None
self
.
_labels
=
None
self
.
_data
=
self
.
_prepare_data
(
data
)
self
.
_data
=
self
.
_prepare_data
(
data
)
default_plot_name
=
self
.
plot_name
# draw full detail plot
self
.
plot_name
=
default_plot_name
+
"
_full_detail
"
self
.
_plot
()
self
.
_plot
()
self
.
_save
()
self
.
_save
()
# draw also a vertical version
# draw also a vertical
full detail
version
self
.
plot_name
+=
"
_vertical
"
self
.
plot_name
=
default_plot_name
+
"
_full_detail
_vertical
"
self
.
_plot_vertical
()
self
.
_plot_vertical
()
self
.
_save
()
self
.
_save
()
# draw default plot with only model comparison
self
.
plot_name
=
default_plot_name
self
.
_plot
(
single_model_comparison
=
True
)
self
.
_save
()
# draw also a vertical full detail version
self
.
plot_name
=
default_plot_name
+
"
_vertical
"
self
.
_plot_vertical
(
single_model_comparison
=
True
)
self
.
_save
()
def
_prepare_data
(
self
,
data
:
pd
.
DataFrame
)
->
pd
.
DataFrame
:
def
_prepare_data
(
self
,
data
:
pd
.
DataFrame
)
->
pd
.
DataFrame
:
"""
"""
...
@@ -724,12 +735,13 @@ class PlotCompetitiveSkillScore(AbstractPlotClass):
...
@@ -724,12 +735,13 @@ class PlotCompetitiveSkillScore(AbstractPlotClass):
self
.
_labels
=
[
str
(
i
)
+
"
d
"
for
i
in
data
.
index
.
levels
[
1
].
values
]
self
.
_labels
=
[
str
(
i
)
+
"
d
"
for
i
in
data
.
index
.
levels
[
1
].
values
]
return
data
.
stack
(
level
=
0
).
reset_index
(
level
=
2
,
drop
=
True
).
reset_index
(
name
=
"
data
"
)
return
data
.
stack
(
level
=
0
).
reset_index
(
level
=
2
,
drop
=
True
).
reset_index
(
name
=
"
data
"
)
def
_plot
(
self
):
def
_plot
(
self
,
single_model_comparison
=
False
):
"""
Plot skill scores of the comparisons.
"""
"""
Plot skill scores of the comparisons.
"""
size
=
max
([
len
(
np
.
unique
(
self
.
_data
.
comparison
)),
6
])
size
=
max
([
len
(
np
.
unique
(
self
.
_data
.
comparison
)),
6
])
fig
,
ax
=
plt
.
subplots
(
figsize
=
(
size
,
size
*
0.8
))
fig
,
ax
=
plt
.
subplots
(
figsize
=
(
size
,
size
*
0.8
))
order
=
self
.
_create_pseudo_order
()
data
=
self
.
_filter_comparisons
(
self
.
_data
)
if
single_model_comparison
is
True
else
self
.
_data
sns
.
boxplot
(
x
=
"
comparison
"
,
y
=
"
data
"
,
hue
=
"
ahead
"
,
data
=
self
.
_data
,
whis
=
1.
,
ax
=
ax
,
palette
=
"
Blues_d
"
,
order
=
self
.
_create_pseudo_order
(
data
)
sns
.
boxplot
(
x
=
"
comparison
"
,
y
=
"
data
"
,
hue
=
"
ahead
"
,
data
=
data
,
whis
=
1.
,
ax
=
ax
,
palette
=
"
Blues_d
"
,
showmeans
=
True
,
meanprops
=
{
"
markersize
"
:
3
,
"
markeredgecolor
"
:
"
k
"
},
flierprops
=
{
"
marker
"
:
"
.
"
},
showmeans
=
True
,
meanprops
=
{
"
markersize
"
:
3
,
"
markeredgecolor
"
:
"
k
"
},
flierprops
=
{
"
marker
"
:
"
.
"
},
order
=
order
)
order
=
order
)
ax
.
axhline
(
y
=
0
,
color
=
"
grey
"
,
linewidth
=
.
5
)
ax
.
axhline
(
y
=
0
,
color
=
"
grey
"
,
linewidth
=
.
5
)
...
@@ -740,11 +752,12 @@ class PlotCompetitiveSkillScore(AbstractPlotClass):
...
@@ -740,11 +752,12 @@ class PlotCompetitiveSkillScore(AbstractPlotClass):
ax
.
legend
(
handles
,
self
.
_labels
)
ax
.
legend
(
handles
,
self
.
_labels
)
plt
.
tight_layout
()
plt
.
tight_layout
()
def
_plot_vertical
(
self
):
def
_plot_vertical
(
self
,
single_model_comparison
=
False
):
"""
Plot skill scores of the comparisons, but vertically aligned.
"""
"""
Plot skill scores of the comparisons, but vertically aligned.
"""
fig
,
ax
=
plt
.
subplots
()
fig
,
ax
=
plt
.
subplots
()
order
=
self
.
_create_pseudo_order
()
data
=
self
.
_filter_comparisons
(
self
.
_data
)
if
single_model_comparison
is
True
else
self
.
_data
sns
.
boxplot
(
y
=
"
comparison
"
,
x
=
"
data
"
,
hue
=
"
ahead
"
,
data
=
self
.
_data
,
whis
=
1.
,
ax
=
ax
,
palette
=
"
Blues_d
"
,
order
=
self
.
_create_pseudo_order
(
data
)
sns
.
boxplot
(
y
=
"
comparison
"
,
x
=
"
data
"
,
hue
=
"
ahead
"
,
data
=
data
,
whis
=
1.
,
ax
=
ax
,
palette
=
"
Blues_d
"
,
showmeans
=
True
,
meanprops
=
{
"
markersize
"
:
3
,
"
markeredgecolor
"
:
"
k
"
},
flierprops
=
{
"
marker
"
:
"
.
"
},
showmeans
=
True
,
meanprops
=
{
"
markersize
"
:
3
,
"
markeredgecolor
"
:
"
k
"
},
flierprops
=
{
"
marker
"
:
"
.
"
},
order
=
order
)
order
=
order
)
# ax.axhline(x=0, color="grey", linewidth=.5)
# ax.axhline(x=0, color="grey", linewidth=.5)
...
@@ -754,12 +767,17 @@ class PlotCompetitiveSkillScore(AbstractPlotClass):
...
@@ -754,12 +767,17 @@ class PlotCompetitiveSkillScore(AbstractPlotClass):
ax
.
legend
(
handles
,
self
.
_labels
)
ax
.
legend
(
handles
,
self
.
_labels
)
plt
.
tight_layout
()
plt
.
tight_layout
()
def
_create_pseudo_order
(
self
):
def
_create_pseudo_order
(
self
,
data
):
"""
Provide first predefined elements and append all remaining.
"""
"""
Provide first predefined elements and append all remaining.
"""
first_elements
=
[
f
"
{
self
.
_model_setup
}
-persi
"
,
"
ols-persi
"
,
f
"
{
self
.
_model_setup
}
-ols
"
]
first_elements
=
[
f
"
{
self
.
_model_setup
}
-persi
"
,
"
ols-persi
"
,
f
"
{
self
.
_model_setup
}
-ols
"
]
uniq
,
index
=
np
.
unique
(
first_elements
+
self
.
_data
.
comparison
.
unique
().
tolist
(),
return_index
=
True
)
first_elements
=
list
(
filter
(
lambda
x
:
x
in
data
.
comparison
.
tolist
(),
first_elements
))
uniq
,
index
=
np
.
unique
(
first_elements
+
data
.
comparison
.
unique
().
tolist
(),
return_index
=
True
)
return
uniq
[
index
.
argsort
()]
return
uniq
[
index
.
argsort
()]
def
_filter_comparisons
(
self
,
data
):
filtered_headers
=
list
(
filter
(
lambda
x
:
"
nn-
"
in
x
,
data
.
comparison
.
unique
()))
return
data
[
data
.
comparison
.
isin
(
filtered_headers
)]
def
_lim
(
self
)
->
Tuple
[
float
,
float
]:
def
_lim
(
self
)
->
Tuple
[
float
,
float
]:
"""
"""
Calculate axis limits from data (Can be used to set axis extend).
Calculate axis limits from data (Can be used to set axis extend).
...
...
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