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
91872f43
Unverified
Commit
91872f43
authored
6 years ago
by
Eric Schanet
Browse files
Options
Downloads
Patches
Plain Diff
Starting to mess with output scores plotting
parent
1b3e3fc3
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
+31
-2
31 additions, 2 deletions
toolkit.py
with
31 additions
and
2 deletions
toolkit.py
+
31
−
2
View file @
91872f43
...
...
@@ -404,7 +404,7 @@ class KerasROOTClassification(object):
try
:
self
.
history
=
History
()
self
.
shuffle_training_data
()
self
.
model
.
fit
(
self
.
x_train
,
# the reshape might be unnescessary here
self
.
y_train
.
reshape
(
-
1
,
1
),
...
...
@@ -541,7 +541,36 @@ class KerasROOTClassification(object):
plt
.
clf
()
def
plot_score
(
self
):
pass
logger
.
info
(
"
Plot output scores
"
)
sig_weights
=
np
.
empty
(
sum
(
self
.
y_test
==
1
))
sig_weights
.
fill
(
self
.
class_weight
[
1
])
bkg_weights
=
np
.
empty
(
sum
(
self
.
y_test
==
0
))
bkg_weights
.
fill
(
self
.
class_weight
[
0
])
print
sig_weights
.
reshape
(
-
1
,
1
).
shape
print
self
.
scores_test
[
self
.
y_test
==
1
].
shape
binning
=
[
20
,
0
,
1
]
fig
=
plt
.
figure
(
figsize
=
(
8
,
6
))
ax1
=
plt
.
subplot2grid
((
4
,
4
),
(
0
,
0
),
colspan
=
4
,
rowspan
=
4
)
ax1
.
tick_params
(
direction
=
'
in
'
)
ax1
.
set_xlim
((
binning
[
1
],
binning
[
2
]))
ax1
.
xaxis
.
set_ticks_position
(
'
both
'
)
ax1
.
yaxis
.
set_ticks_position
(
'
both
'
)
s_histTest
,
s_binsTest
,
s_patchesTest
=
plt
.
hist
(
self
.
scores_test
[
self
.
y_test
==
1
],
weights
=
sig_weights
.
reshape
(
-
1
,
1
),
histtype
=
'
stepfilled
'
,
color
=
'
r
'
,
label
=
'
Signal (Training)
'
,
alpha
=
0.5
,
bins
=
binning
[
0
],
range
=
(
binning
[
1
],
binning
[
2
]))
b_histTest
,
b_binsTest
,
b_patchesTest
=
plt
.
hist
(
self
.
scores_test
[
self
.
y_test
==
0
],
weights
=
bkg_weights
.
reshape
(
-
1
,
1
),
histtype
=
'
stepfilled
'
,
color
=
'
b
'
,
label
=
'
Background (Training)
'
,
alpha
=
0.5
,
bins
=
binning
[
0
],
range
=
(
binning
[
1
],
binning
[
2
]))
plt
.
xlabel
(
'
Output score
'
)
plt
.
ylabel
(
'
a.u.
'
)
plt
.
legend
(
loc
=
'
upper right
'
,
framealpha
=
1.0
)
plt
.
savefig
(
os
.
path
.
join
(
self
.
project_dir
,
"
scores.pdf
"
))
plt
.
clf
()
def
plot_loss
(
self
):
...
...
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