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
e4804183
Commit
e4804183
authored
5 years ago
by
lukas leufen
Browse files
Options
Downloads
Patches
Plain Diff
corrected plot metric functionality to be able to plot the (total) loss without "main" too
parent
012a05cb
No related branches found
No related tags found
2 merge requests
!37
include new development
,
!26
Lukas issue034 feat plot mse history
Pipeline
#28463
passed
5 years ago
Stage: test
Stage: pages
Stage: deploy
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/plotting/training_monitoring.py
+14
-2
14 additions, 2 deletions
src/plotting/training_monitoring.py
src/run_modules/model_setup.py
+2
-2
2 additions, 2 deletions
src/run_modules/model_setup.py
src/run_modules/training.py
+6
-1
6 additions, 1 deletion
src/run_modules/training.py
with
22 additions
and
5 deletions
src/plotting/training_monitoring.py
+
14
−
2
View file @
e4804183
...
@@ -25,7 +25,7 @@ class PlotModelHistory:
...
@@ -25,7 +25,7 @@ class PlotModelHistory:
metrics). The plot is saved locally. For a proper saving behaviour, the parameter filename must include the absolute
metrics). The plot is saved locally. For a proper saving behaviour, the parameter filename must include the absolute
path for the plot.
path for the plot.
"""
"""
def
__init__
(
self
,
filename
:
str
,
history
:
history_object
,
plot_metric
:
str
=
"
loss
"
):
def
__init__
(
self
,
filename
:
str
,
history
:
history_object
,
plot_metric
:
str
=
"
loss
"
,
main_branch
:
bool
=
True
):
"""
"""
Sets attributes and create plot
Sets attributes and create plot
:param filename: saving name of the plot to create (preferably absolute path if possible), the filename needs a
:param filename: saving name of the plot to create (preferably absolute path if possible), the filename needs a
...
@@ -35,10 +35,22 @@ class PlotModelHistory:
...
@@ -35,10 +35,22 @@ class PlotModelHistory:
if
isinstance
(
history
,
keras
.
callbacks
.
History
):
if
isinstance
(
history
,
keras
.
callbacks
.
History
):
history
=
history
.
history
history
=
history
.
history
self
.
_data
=
pd
.
DataFrame
.
from_dict
(
history
)
self
.
_data
=
pd
.
DataFrame
.
from_dict
(
history
)
self
.
_plot_metric
=
plot_metric
self
.
_plot_metric
=
self
.
_get_
plot_metric
(
history
,
plot_metric
,
main_branch
)
self
.
_additional_columns
=
self
.
_filter_columns
(
history
)
self
.
_additional_columns
=
self
.
_filter_columns
(
history
)
self
.
_plot
(
filename
)
self
.
_plot
(
filename
)
@staticmethod
def
_get_plot_metric
(
history
,
plot_metric
,
main_branch
):
if
plot_metric
.
lower
()
==
"
mse
"
:
plot_metric
=
"
mean_squared_error
"
elif
plot_metric
.
lower
()
==
"
mae
"
:
plot_metric
=
"
mean_absolute_error
"
available_keys
=
[
k
for
k
in
history
.
keys
()
if
plot_metric
in
k
and
(
"
main
"
in
k
if
main_branch
else
True
)]
print
(
available_keys
)
available_keys
.
sort
(
key
=
len
)
print
(
available_keys
)
return
available_keys
[
0
]
def
_filter_columns
(
self
,
history
:
Dict
)
->
List
[
str
]:
def
_filter_columns
(
self
,
history
:
Dict
)
->
List
[
str
]:
"""
"""
Select only columns named like %<plot_metric>%. The default metrics
'
<plot_metric>
'
and
'
val_<plot_metric>
'
are
Select only columns named like %<plot_metric>%. The default metrics
'
<plot_metric>
'
and
'
val_<plot_metric>
'
are
...
...
This diff is collapsed.
Click to expand it.
src/run_modules/model_setup.py
+
2
−
2
View file @
e4804183
...
@@ -15,8 +15,8 @@ from src.run_modules.run_environment import RunEnvironment
...
@@ -15,8 +15,8 @@ from src.run_modules.run_environment import RunEnvironment
from
src.helpers
import
l_p_loss
,
LearningRateDecay
from
src.helpers
import
l_p_loss
,
LearningRateDecay
from
src.model_modules.inception_model
import
InceptionModelBase
from
src.model_modules.inception_model
import
InceptionModelBase
from
src.model_modules.flatten
import
flatten_tail
from
src.model_modules.flatten
import
flatten_tail
#
from src.model_modules.model_class import MyBranchedModel as MyModel
from
src.model_modules.model_class
import
MyBranchedModel
as
MyModel
from
src.model_modules.model_class
import
MyLittleModel
as
MyModel
#
from src.model_modules.model_class import MyLittleModel as MyModel
class
ModelSetup
(
RunEnvironment
):
class
ModelSetup
(
RunEnvironment
):
...
...
This diff is collapsed.
Click to expand it.
src/run_modules/training.py
+
6
−
1
View file @
e4804183
...
@@ -134,5 +134,10 @@ class Training(RunEnvironment):
...
@@ -134,5 +134,10 @@ class Training(RunEnvironment):
"""
"""
path
=
self
.
data_store
.
get
(
"
plot_path
"
,
"
general
"
)
path
=
self
.
data_store
.
get
(
"
plot_path
"
,
"
general
"
)
name
=
self
.
data_store
.
get
(
"
experiment_name
"
,
"
general
"
)
name
=
self
.
data_store
.
get
(
"
experiment_name
"
,
"
general
"
)
PlotModelHistory
(
filename
=
os
.
path
.
join
(
path
,
f
"
{
name
}
_history_loss_val_loss.pdf
"
),
history
=
history
)
filename
=
os
.
path
.
join
(
path
,
f
"
{
name
}
_history_loss.pdf
"
)
PlotModelHistory
(
filename
=
filename
,
history
=
history
,
main_branch
=
False
)
filename
=
os
.
path
.
join
(
path
,
f
"
{
name
}
_history_main_loss.pdf
"
)
PlotModelHistory
(
filename
=
filename
,
history
=
history
)
filename
=
os
.
path
.
join
(
path
,
f
"
{
name
}
_history_main_mse.pdf
"
)
PlotModelHistory
(
filename
=
filename
,
history
=
history
,
plot_metric
=
"
mse
"
)
PlotModelLearningRate
(
filename
=
os
.
path
.
join
(
path
,
f
"
{
name
}
_history_learning_rate.pdf
"
),
lr_sc
=
lr_sc
)
PlotModelLearningRate
(
filename
=
os
.
path
.
join
(
path
,
f
"
{
name
}
_history_learning_rate.pdf
"
),
lr_sc
=
lr_sc
)
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