Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
MAWK
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
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
wilhelmk
MAWK
Commits
fc4db609
There was an error fetching the commit references. Please try again later.
Commit
fc4db609
authored
Jul 28, 2016
by
wilhelmk
Browse files
Options
Downloads
Patches
Plain Diff
plot tweak for publication paper
parent
62f3aaa1
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
pso_plots.py
+2
-2
2 additions, 2 deletions
pso_plots.py
sensitivity.py
+1
-1
1 addition, 1 deletion
sensitivity.py
thesis_plots.py
+29
-28
29 additions, 28 deletions
thesis_plots.py
with
32 additions
and
31 deletions
pso_plots.py
+
2
−
2
View file @
fc4db609
...
...
@@ -285,14 +285,14 @@ def plot_convergence(resultspath, hyper=1):
imagepath
,
run_specifier
=
split
(
resultspath
)
xticks
=
np
.
arange
(
1
,
len
(
iter_paths
)
+
1
,
1
)
w
=
10
w
=
7
h
=
w
*
(
sqrt
(
5
)
-
1.0
)
/
2.0
plt
.
figure
(
'
Evaluations and global best trend
'
,
figsize
=
(
w
,
h
))
gbest_per_iter
=
np
.
roll
(
gbest_per_iter
,
-
1
)
gbest_per_iter
[
-
1
]
=
gbest_per_iter
[
-
2
]
plt
.
boxplot
(
eval_per_iter
)
plt
.
plot
(
xticks
,
gbest_per_iter
,
color
=
'
green
'
)
plt
.
title
(
'
particle test errors and global best trend
'
)
#
plt.title('particle test errors and global best trend')
plt
.
xticks
(
xticks
[
9
::
10
],
[
str
(
s
)
for
s
in
xticks
[
9
::
10
]])
plt
.
xlabel
(
'
iteration
'
)
plt
.
ylabel
(
'
mean MSE in K²
'
)
...
...
This diff is collapsed.
Click to expand it.
sensitivity.py
+
1
−
1
View file @
fc4db609
...
...
@@ -176,7 +176,7 @@ def plot_consistency_runs(path_to_models, title='consistency'):
plt
.
grid
(
True
)
plt
.
ylabel
(
'
number of models
'
)
#plt.xticks(np.arange(df.shape[1]) + 1, df.columns)
plt
.
xlabel
(
'
mean
score
in K²
'
)
plt
.
xlabel
(
'
mean
MSE
in K²
'
)
plt
.
title
(
'
scatter, {} samples
'
.
format
(
df
.
shape
[
0
]))
xmin
,
xmax
=
plt
.
xlim
()
ymin
,
ymax
=
plt
.
ylim
()
...
...
This diff is collapsed.
Click to expand it.
thesis_plots.py
+
29
−
28
View file @
fc4db609
import
matplotlib
import
matplotlib.pyplot
as
plt
import
matplotlib
as
mlp
import
numpy
as
np
from
mawk.trainer
import
Trainer
from
mawk.datascript
import
DataPack
import
argparse
import
os
from
os.path
import
join
,
splitext
,
split
from
os
import
listdir
from
math
import
ceil
,
sqrt
from
os.path
import
split
import
pandas
as
pd
from
visuals
import
setup_vis_trainer
,
plot_net_prediction
from
visuals
import
setup_vis_trainer
predictions_store
=
'
/home/wilhelmk/MAWK_trainresults/pso/hdf/predictions
'
evaluations_store
=
'
/home/wilhelmk/MAWK_trainresults/pso/hdf/evaluations
'
...
...
@@ -26,10 +22,10 @@ winding_best_path = \
# get predictions and groundtruth
targets
=
[
pm_best_path
,
yoke_best_path
,
teeth_best_path
,
winding_best_path
]
target_labels
=
[
'
pm
'
,
'
statorjoch
'
,
'
statorzahn
'
,
'
statorwicklung
'
]
target_labels_y
=
{
'
pm
'
:
[
'
$
\\
vartheta_{PM}$
'
,
'
p
ermanent
m
agnets
'
],
'
statorjoch
'
:
[
'
$
\\
vartheta_{SY}$
'
,
'
s
tator
y
oke
'
],
'
statorzahn
'
:
[
'
$
\\
vartheta_{ST}$
'
,
'
s
tator
t
eeth
'
],
'
statorwicklung
'
:
[
'
$
\\
vartheta_{SW}$
'
,
'
s
tator
w
inding
'
]}
target_labels_y
=
{
'
pm
'
:
[
'
$
\\
vartheta_{PM}$
'
,
'
P
ermanent
M
agnets
'
],
'
statorjoch
'
:
[
'
$
\\
vartheta_{SY}$
'
,
'
S
tator
Y
oke
'
],
'
statorzahn
'
:
[
'
$
\\
vartheta_{ST}$
'
,
'
S
tator
T
eeth
'
],
'
statorwicklung
'
:
[
'
$
\\
vartheta_{SW}$
'
,
'
S
tator
W
inding
'
]}
target_predictions
=
[]
target_groundtruths
=
[]
for
t
in
targets
:
...
...
@@ -79,13 +75,13 @@ assert len(target_groundtruths) == len(target_labels) and len(
datapack
=
DataPack
(
root
=
'
tp
'
,
xp
=
np
)
x_test
,
y_test
=
datapack
.
load_profiles
([
20
,
])
# load testset
motorspeed
=
[
datapack
.
_convert_namedtup2matrix
(
x_test
[
0
].
drehzahl
),
'
m
otor
s
peed
'
,
'
$n_{mech}$ in 1/min
'
]
'
M
otor
S
peed
'
,
'
$n_{mech}$ in 1/min
'
]
torque
=
[
datapack
.
_convert_namedtup2matrix
(
x_test
[
0
].
T_ist
),
'
t
orque
'
,
'
$T_x$ in Nm
'
]
'
T
orque
'
,
'
$T_x$ in Nm
'
]
ambient
=
[
datapack
.
_convert_namedtup2matrix
(
x_test
[
0
].
ambient
),
'
a
mbient
t
emperature
'
,
'
$
\\
vartheta_a$ in °C
'
]
'
A
mbient
T
emperature
'
,
'
$
\\
vartheta_a$ in °C
'
]
coolant
=
[
datapack
.
_convert_namedtup2matrix
(
x_test
[
0
].
vorlauf
),
'
c
oolant
t
emperature
'
,
'
$
\\
vartheta_c$ in °C
'
]
'
C
oolant
T
emperature
'
,
'
$
\\
vartheta_c$ in °C
'
]
# prune uninteresting targets in stator prediction away
target_predictions
=
[
target_predictions
[
0
].
ravel
(),
...
...
@@ -96,8 +92,11 @@ target_groundtruths = [target_groundtruths[0].ravel(),
target_groundtruths
[
1
][
0
,
:],
target_groundtruths
[
2
][
1
,
:],
target_groundtruths
[
3
][
2
,
:]]
# Plot everything
plt
.
figure
(
'
best predictions
'
,
figsize
=
(
10
,
10
))
mlp
.
rcParams
.
update
({
'
font.family
'
:
'
serif
'
,
'
font.size
'
:
7
})
plt
.
figure
(
'
best predictions
'
,
figsize
=
(
7
,
7
),
dpi
=
100
)
time
=
np
.
arange
(
ambient
[
0
].
shape
[
1
],
dtype
=
np
.
float32
)
time
/=
(
2
*
60
)
for
i
,
(
pred
,
truth
)
in
enumerate
(
zip
(
target_predictions
,
target_groundtruths
)):
...
...
@@ -108,10 +107,10 @@ for i, (pred, truth) in enumerate(zip(target_predictions, target_groundtruths)):
plt
.
ylabel
(
target_labels_y
[
target_labels
[
i
]][
0
]
+
'
in °C
'
)
plt
.
xlim
(
xmax
=
max
(
time
))
start
,
end
=
plt
.
ylim
()
if
title
in
(
'
p
ermanent
m
agnets
'
,
'
s
tator
y
oke
'
):
if
title
in
(
'
P
ermanent
M
agnets
'
,
'
S
tator
Y
oke
'
):
plt
.
ylim
(
ymax
=
end
+
3
)
plt
.
yticks
(
np
.
arange
(
start
,
end
+
3
,
20
))
if
title
==
'
s
tator
w
inding
'
:
if
title
==
'
S
tator
W
inding
'
:
plt
.
yticks
(
np
.
arange
(
start
,
end
,
25
))
plt
.
title
(
title
)
plt
.
grid
(
True
)
...
...
@@ -121,14 +120,16 @@ for i, (pred, truth) in enumerate(zip(target_predictions, target_groundtruths)):
plt
.
ylabel
(
'
$\Delta$
'
+
target_labels_y
[
target_labels
[
i
]][
0
]
+
'
in °C
'
)
plt
.
xlim
(
xmax
=
max
(
time
))
start
,
end
=
plt
.
ylim
()
if
title
==
'
stator teeth
'
:
if
title
==
'
Stator Yoke
'
:
plt
.
yticks
(
np
.
arange
(
start
,
end
+
1
,
3
))
if
title
==
'
Stator Teeth
'
:
plt
.
yticks
(
np
.
arange
(
start
,
end
,
4
))
if
title
==
'
s
tator
w
inding
'
:
if
title
==
'
S
tator
W
inding
'
:
plt
.
yticks
(
np
.
arange
(
start
,
end
+
4
,
10
))
if
title
==
'
p
ermanent
m
agnets
'
:
if
title
==
'
P
ermanent
M
agnets
'
:
plt
.
yticks
(
np
.
arange
(
start
-
1
,
end
,
8
))
plt
.
title
(
'
d
eviation:
'
+
target_labels_y
[
target_labels
[
i
]][
1
])
plt
.
title
(
'
D
eviation:
'
+
target_labels_y
[
target_labels
[
i
]][
1
])
plt
.
grid
(
True
)
print
(
'
max. dev for {}: {} °C
'
.
format
(
target_labels_y
[
target_labels
[
i
]][
1
],
np
.
abs
(
pred
-
truth
).
max
()))
...
...
@@ -142,14 +143,14 @@ for m, m_title, m_ylb in [motorspeed, torque, ambient, coolant]:
plt
.
title
(
m_title
)
plt
.
grid
(
True
)
plt
.
xlim
(
xmax
=
max
(
time
))
if
m_title
in
(
'
m
otor
s
peed
'
,
'
t
orque
'
):
if
m_title
in
(
'
M
otor
S
peed
'
,
'
T
orque
'
):
plt
.
ylim
(
ymin
=
0
)
start
,
end
=
plt
.
ylim
()
if
m_title
==
'
m
otor
s
peed
'
:
if
m_title
==
'
M
otor
S
peed
'
:
plt
.
yticks
(
np
.
arange
(
start
,
end
+
500
,
1500
))
if
m_title
==
'
a
mbient
t
emperature
'
:
if
m_title
==
'
A
mbient
T
emperature
'
:
plt
.
yticks
(
np
.
arange
(
start
,
end
,
4
))
if
m_title
==
'
c
oolant
t
emperature
'
:
if
m_title
==
'
C
oolant
T
emperature
'
:
plt
.
yticks
(
np
.
arange
(
start
,
end
+
2
,
15
))
if
i
>
10
:
plt
.
xlabel
(
'
time in minutes
'
)
...
...
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