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
2e2344e7
Unverified
Commit
2e2344e7
authored
6 years ago
by
Eric Schanet
Browse files
Options
Downloads
Patches
Plain Diff
Fixing ROC AUC computation
parent
365ba76d
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
toolkit.py
+8
-7
8 additions, 7 deletions
toolkit.py
with
8 additions
and
7 deletions
toolkit.py
+
8
−
7
View file @
2e2344e7
...
...
@@ -13,7 +13,7 @@ import pandas as pd
import
h5py
from
sklearn.preprocessing
import
StandardScaler
,
RobustScaler
from
sklearn.externals
import
joblib
from
sklearn.metrics
import
roc_curve
from
sklearn.metrics
import
roc_curve
,
auc
from
keras.models
import
Sequential
from
keras.layers
import
Dense
...
...
@@ -128,7 +128,7 @@ class KerasROOTClassification:
self
.
b_train
=
tree2array
(
bkg_chain
,
branches
=
self
.
branches
+
[
self
.
weight_expr
]
+
self
.
identifiers
,
selection
=
self
.
selection
,
start
=
0
,
step
=
2
)
start
=
0
,
step
=
2
00
)
self
.
s_test
=
tree2array
(
signal_chain
,
branches
=
self
.
branches
+
[
self
.
weight_expr
],
selection
=
self
.
selection
,
...
...
@@ -136,7 +136,7 @@ class KerasROOTClassification:
self
.
b_test
=
tree2array
(
bkg_chain
,
branches
=
self
.
branches
+
[
self
.
weight_expr
],
selection
=
self
.
selection
,
start
=
1
,
step
=
2
)
start
=
1
,
step
=
2
00
)
self
.
_dump_training_list
()
self
.
s_eventlist_train
=
self
.
s_train
[
self
.
identifiers
]
...
...
@@ -404,13 +404,15 @@ class KerasROOTClassification:
logger
.
info
(
"
Plot ROC curve
"
)
fpr
,
tpr
,
threshold
=
roc_curve
(
self
.
y_test
,
self
.
scores_test
,
sample_weight
=
self
.
w_test
)
fpr
=
1.0
-
fpr
roc_auc
=
auc
(
tpr
,
fpr
)
plt
.
grid
(
color
=
'
gray
'
,
linestyle
=
'
--
'
,
linewidth
=
1
)
plt
.
plot
(
f
pr
,
t
pr
,
label
=
'
NN
'
)
plt
.
plot
(
t
pr
,
f
pr
,
label
=
'
NN
'
)
plt
.
plot
([
0
,
1
],[
1
,
0
],
linestyle
=
'
--
'
,
color
=
'
black
'
,
label
=
'
Luck
'
)
plt
.
xlabel
(
"
False positive rate (b
ackground rejection
)
"
)
plt
.
y
label
(
"
True positive rate (s
ignal efficiency
)
"
)
plt
.
xlabel
(
"
B
ackground rejection
"
)
plt
.
x
label
(
"
S
ignal efficiency
"
)
plt
.
title
(
'
Receiver operating characteristic
'
)
plt
.
xlim
(
0
,
1
)
plt
.
ylim
(
0
,
1
)
...
...
@@ -421,7 +423,6 @@ class KerasROOTClassification:
plt
.
savefig
(
os
.
path
.
join
(
self
.
project_dir
,
"
ROC.pdf
"
))
plt
.
clf
()
def
plot_score
(
self
):
pass
...
...
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