Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
K
KerasROOTClassification
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
Nikolai.Hartmann
KerasROOTClassification
Commits
3432c091
Commit
3432c091
authored
6 years ago
by
Nikolai.Hartmann
Browse files
Options
Downloads
Patches
Plain Diff
ylim option for loss plot
parent
9db4ffce
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
toolkit.py
+4
-2
4 additions, 2 deletions
toolkit.py
with
4 additions
and
2 deletions
toolkit.py
+
4
−
2
View file @
3432c091
...
...
@@ -845,7 +845,7 @@ class ClassificationProject(object):
centers_bkg
,
hist_bkg
,
_
=
self
.
get_bin_centered_hist
(
bkg
,
scale_factor
=
self
.
class_weight
[
0
],
bins
=
50
,
range
=
plot_range
,
weights
=
bkg_weights
)
except
ValueError
:
# weird, probably not always working workaround for a numpy bug
plot_range
=
(
float
(
"
{:.
2
f}
"
.
format
(
plot_range
[
0
])),
float
(
"
{:.
2
f}
"
.
format
(
plot_range
[
1
])))
plot_range
=
(
float
(
"
{:.
3
f}
"
.
format
(
plot_range
[
0
])),
float
(
"
{:.
3
f}
"
.
format
(
plot_range
[
1
])))
logger
.
warn
(
"
Got a value error during plotting, maybe this is due to a numpy bug - changing range to {}
"
.
format
(
plot_range
))
centers_sig
,
hist_sig
,
_
=
self
.
get_bin_centered_hist
(
sig
,
scale_factor
=
self
.
class_weight
[
1
],
bins
=
50
,
range
=
plot_range
,
weights
=
sig_weights
)
centers_bkg
,
hist_bkg
,
_
=
self
.
get_bin_centered_hist
(
bkg
,
scale_factor
=
self
.
class_weight
[
0
],
bins
=
50
,
range
=
plot_range
,
weights
=
bkg_weights
)
...
...
@@ -980,7 +980,7 @@ class ClassificationProject(object):
hist_dict
[
hist_key
]
=
[
float
(
line
[
hist_key_index
])
for
line
in
history_list
[
1
:]]
return
hist_dict
def
plot_loss
(
self
,
all_trainings
=
False
,
log
=
False
):
def
plot_loss
(
self
,
all_trainings
=
False
,
log
=
False
,
ylim
=
None
):
"""
Plot the value of the loss function for each epoch
...
...
@@ -1004,6 +1004,8 @@ class ClassificationProject(object):
plt
.
legend
([
'
train
'
,
'
test
'
],
loc
=
'
upper left
'
)
if
log
:
plt
.
yscale
(
"
log
"
)
if
ylim
is
not
None
:
plt
.
ylim
(
*
ylim
)
plt
.
savefig
(
os
.
path
.
join
(
self
.
project_dir
,
"
losses.pdf
"
))
plt
.
clf
()
...
...
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