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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
esde
machine-learning
MLAir
Commits
7c149021
Commit
7c149021
authored
2 years ago
by
leufen1
Browse files
Options
Downloads
Patches
Plain Diff
aded kde plot
parent
bce92b10
No related branches found
No related tags found
3 merge requests
!500
Develop
,
!499
Resolve "release v2.3.0"
,
!496
Resolve "Frequency error plots"
Pipeline
#114210
passed
2 years ago
Stage: test
Stage: docs
Stage: pages
Stage: deploy
Changes
1
Pipelines
3
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
mlair/plotting/postprocessing_plotting.py
+56
-0
56 additions, 0 deletions
mlair/plotting/postprocessing_plotting.py
with
56 additions
and
0 deletions
mlair/plotting/postprocessing_plotting.py
+
56
−
0
View file @
7c149021
...
@@ -1119,12 +1119,14 @@ class PlotSampleUncertaintyFromBootstrap(AbstractPlotClass): # pragma: no cover
...
@@ -1119,12 +1119,14 @@ class PlotSampleUncertaintyFromBootstrap(AbstractPlotClass): # pragma: no cover
# plot raw metric (mse)
# plot raw metric (mse)
for
orientation
,
utest
,
agg_type
in
variants
:
for
orientation
,
utest
,
agg_type
in
variants
:
self
.
_plot
(
orientation
=
orientation
,
apply_u_test
=
utest
,
agg_type
=
agg_type
,
season
=
_season
)
self
.
_plot
(
orientation
=
orientation
,
apply_u_test
=
utest
,
agg_type
=
agg_type
,
season
=
_season
)
self
.
_plot_kde
(
agg_type
=
agg_type
,
season
=
_season
)
if
apply_root
is
True
:
if
apply_root
is
True
:
# plot root of metric (rmse)
# plot root of metric (rmse)
self
.
_apply_root
()
self
.
_apply_root
()
for
orientation
,
utest
,
agg_type
in
variants
:
for
orientation
,
utest
,
agg_type
in
variants
:
self
.
_plot
(
orientation
=
orientation
,
apply_u_test
=
utest
,
agg_type
=
agg_type
,
tag
=
"
_sqrt
"
,
season
=
_season
)
self
.
_plot
(
orientation
=
orientation
,
apply_u_test
=
utest
,
agg_type
=
agg_type
,
tag
=
"
_sqrt
"
,
season
=
_season
)
self
.
_plot_kde
(
agg_type
=
agg_type
,
tag
=
"
_sqrt
"
,
season
=
_season
)
self
.
_data_table
=
None
self
.
_data_table
=
None
self
.
_n_boots
=
None
self
.
_n_boots
=
None
...
@@ -1153,6 +1155,60 @@ class PlotSampleUncertaintyFromBootstrap(AbstractPlotClass): # pragma: no cover
...
@@ -1153,6 +1155,60 @@ class PlotSampleUncertaintyFromBootstrap(AbstractPlotClass): # pragma: no cover
self
.
error_measure
=
f
"
root
{
self
.
error_measure
}
"
self
.
error_measure
=
f
"
root
{
self
.
error_measure
}
"
self
.
error_unit
=
self
.
error_unit
.
replace
(
"
$^2$
"
,
""
)
self
.
error_unit
=
self
.
error_unit
.
replace
(
"
$^2$
"
,
""
)
def
_plot_kde
(
self
,
agg_type
=
"
single
"
,
tag
=
""
,
season
=
""
):
self
.
plot_name
=
self
.
default_plot_name
+
"
_kde
"
+
"
_
"
+
agg_type
+
tag
+
{
""
:
""
}.
get
(
season
,
f
"
_
{
season
}
"
)
data_table
=
self
.
_data_table
if
agg_type
==
"
multi
"
:
return
# nothing to do
if
self
.
ahead_dim
not
in
data_table
.
index
.
names
and
agg_type
==
"
panel
"
:
return
# nothing to do
n_boots
=
self
.
_n_boots
error_label
=
self
.
error_measure
if
self
.
error_unit
is
None
else
f
"
{
self
.
error_measure
}
(in
{
self
.
error_unit
}
)
"
if
agg_type
==
"
single
"
:
fig
,
ax
=
plt
.
subplots
()
if
self
.
ahead_dim
in
data_table
.
index
.
names
:
data_table
=
data_table
.
groupby
(
level
=
0
).
mean
()
sns
.
kdeplot
(
data
=
data_table
,
ax
=
ax
)
ylims
=
list
(
ax
.
get_ylim
())
ax
.
set_ylim
([
ylims
[
0
],
ylims
[
1
]
*
1.025
])
ax
.
set_xlabel
(
error_label
)
text
=
f
"
n=
{
n_boots
}
"
if
self
.
block_length
is
not
None
:
text
=
f
"
{
self
.
block_length
}
,
{
text
}
"
if
len
(
season
)
>
0
:
text
=
f
"
{
season
}
,
{
text
}
"
loc
=
"
upper left
"
text_box
=
AnchoredText
(
text
,
frameon
=
True
,
loc
=
loc
,
pad
=
0.5
,
bbox_to_anchor
=
(
0.
,
1.0
),
bbox_transform
=
ax
.
transAxes
)
plt
.
setp
(
text_box
.
patch
,
edgecolor
=
'
k
'
,
facecolor
=
'
w
'
)
ax
.
add_artist
(
text_box
)
ax
.
get_legend
().
set_title
(
None
)
plt
.
tight_layout
()
else
:
g
=
sns
.
FacetGrid
(
data_table
.
stack
(
self
.
model_type_dim
).
reset_index
(),
**
{
"
col
"
:
self
.
ahead_dim
},
hue
=
self
.
model_type_dim
,
legend_out
=
True
)
g
.
map
(
sns
.
kdeplot
,
0
)
g
.
add_legend
(
title
=
""
)
fig
=
plt
.
gcf
()
_labels
=
[
str
(
i
)
+
self
.
sampling
for
i
in
data_table
.
index
.
levels
[
1
].
values
]
for
axi
,
title
in
zip
(
g
.
axes
.
flatten
(),
_labels
):
axi
.
set_title
(
title
)
for
axi
in
g
.
axes
.
flatten
():
axi
.
set_xlabel
(
None
)
fig
.
supxlabel
(
error_label
)
text
=
f
"
n=
{
n_boots
}
"
if
self
.
block_length
is
not
None
:
text
=
f
"
{
self
.
block_length
}
,
{
text
}
"
if
len
(
season
)
>
0
:
text
=
f
"
{
season
}
,
{
text
}
"
loc
=
"
upper right
"
text_box
=
AnchoredText
(
text
,
frameon
=
True
,
loc
=
loc
)
plt
.
setp
(
text_box
.
patch
,
edgecolor
=
'
k
'
,
facecolor
=
'
w
'
)
g
.
axes
.
flatten
()[
0
].
add_artist
(
text_box
)
self
.
_save
()
plt
.
close
(
"
all
"
)
def
_plot
(
self
,
orientation
:
str
=
"
v
"
,
apply_u_test
:
bool
=
False
,
agg_type
=
"
single
"
,
tag
=
""
,
season
=
""
):
def
_plot
(
self
,
orientation
:
str
=
"
v
"
,
apply_u_test
:
bool
=
False
,
agg_type
=
"
single
"
,
tag
=
""
,
season
=
""
):
self
.
plot_name
=
self
.
default_plot_name
+
{
"
v
"
:
"
_vertical
"
,
"
h
"
:
"
_horizontal
"
}[
orientation
]
+
\
self
.
plot_name
=
self
.
default_plot_name
+
{
"
v
"
:
"
_vertical
"
,
"
h
"
:
"
_horizontal
"
}[
orientation
]
+
\
{
True
:
"
_u_test
"
,
False
:
""
}[
apply_u_test
]
+
"
_
"
+
agg_type
+
tag
+
\
{
True
:
"
_u_test
"
,
False
:
""
}[
apply_u_test
]
+
"
_
"
+
agg_type
+
tag
+
\
...
...
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