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
Eric.Schanet
KerasROOTClassification
Commits
cb4b04fc
Commit
cb4b04fc
authored
6 years ago
by
Nikolai.Hartmann
Browse files
Options
Downloads
Patches
Plain Diff
Rename project class to ClassificationProject
parent
ce7b4c4f
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
__init__.py
+3
-0
3 additions, 0 deletions
__init__.py
compare.py
+8
-8
8 additions, 8 deletions
compare.py
toolkit.py
+18
-18
18 additions, 18 deletions
toolkit.py
with
29 additions
and
26 deletions
__init__.py
0 → 100644
+
3
−
0
View file @
cb4b04fc
from
toolkit
import
ClassificationProject
from
compare
import
overlay_ROC
,
overlay_loss
This diff is collapsed.
Click to expand it.
compare.py
+
8
−
8
View file @
cb4b04fc
...
@@ -7,7 +7,7 @@ import numpy as np
...
@@ -7,7 +7,7 @@ import numpy as np
import
matplotlib.pyplot
as
plt
import
matplotlib.pyplot
as
plt
from
sklearn.metrics
import
roc_curve
,
auc
from
sklearn.metrics
import
roc_curve
,
auc
from
toolkit
import
KerasROOT
Classification
from
toolkit
import
Classification
Project
"""
"""
A few functions to compare different setups
A few functions to compare different setups
...
@@ -76,14 +76,14 @@ if __name__ == "__main__":
...
@@ -76,14 +76,14 @@ if __name__ == "__main__":
identifiers
=
[
"
DatasetNumber
"
,
"
EventNumber
"
],
identifiers
=
[
"
DatasetNumber
"
,
"
EventNumber
"
],
step_bkg
=
100
)
step_bkg
=
100
)
example1
=
KerasROOT
Classification
(
"
test_sgd
"
,
example1
=
Classification
Project
(
"
test_sgd
"
,
optimizer
=
"
SGD
"
,
optimizer
=
"
SGD
"
,
optimizer_opts
=
dict
(
lr
=
1000.
,
decay
=
1e-6
,
momentum
=
0.9
),
optimizer_opts
=
dict
(
lr
=
1000.
,
decay
=
1e-6
,
momentum
=
0.9
),
**
data_options
)
**
data_options
)
example2
=
KerasROOT
Classification
(
"
test_adam
"
,
example2
=
Classification
Project
(
"
test_adam
"
,
optimizer
=
"
Adam
"
,
optimizer
=
"
Adam
"
,
**
data_options
)
**
data_options
)
if
not
os
.
path
.
exists
(
"
outputs/test_sgd/scores_test.h5
"
):
if
not
os
.
path
.
exists
(
"
outputs/test_sgd/scores_test.h5
"
):
...
...
This diff is collapsed.
Click to expand it.
toolkit.py
+
18
−
18
View file @
cb4b04fc
...
@@ -41,7 +41,7 @@ K.set_session(session)
...
@@ -41,7 +41,7 @@ K.set_session(session)
import
ROOT
import
ROOT
class
KerasROOT
Classification
(
object
):
class
Classification
Project
(
object
):
"""
Simple framework to load data from ROOT TTrees and train Keras
"""
Simple framework to load data from ROOT TTrees and train Keras
neural networks for classification according to some global settings.
neural networks for classification according to some global settings.
...
@@ -751,9 +751,9 @@ def create_setter(dataset_name):
...
@@ -751,9 +751,9 @@ def create_setter(dataset_name):
return
setx
return
setx
# define getters and setters for all datasets
# define getters and setters for all datasets
for
dataset_name
in
KerasROOT
Classification
.
dataset_names
:
for
dataset_name
in
Classification
Project
.
dataset_names
:
setattr
(
KerasROOT
Classification
,
dataset_name
,
property
(
create_getter
(
dataset_name
),
setattr
(
Classification
Project
,
dataset_name
,
property
(
create_getter
(
dataset_name
),
create_setter
(
dataset_name
)))
create_setter
(
dataset_name
)))
if
__name__
==
"
__main__
"
:
if
__name__
==
"
__main__
"
:
...
@@ -764,21 +764,21 @@ if __name__ == "__main__":
...
@@ -764,21 +764,21 @@ if __name__ == "__main__":
filename
=
"
/project/etp4/nhartmann/trees/allTrees_m1.8_NoSys.root
"
filename
=
"
/project/etp4/nhartmann/trees/allTrees_m1.8_NoSys.root
"
c
=
KerasROOT
Classification
(
"
test4
"
,
c
=
Classification
Project
(
"
test4
"
,
signal_trees
=
[(
filename
,
"
GG_oneStep_1705_1105_505_NoSys
"
)],
signal_trees
=
[(
filename
,
"
GG_oneStep_1705_1105_505_NoSys
"
)],
bkg_trees
=
[(
filename
,
"
ttbar_NoSys
"
),
bkg_trees
=
[(
filename
,
"
ttbar_NoSys
"
),
(
filename
,
"
wjets_Sherpa221_NoSys
"
)
(
filename
,
"
wjets_Sherpa221_NoSys
"
)
],
],
optimizer
=
"
Adam
"
,
optimizer
=
"
Adam
"
,
#optimizer="SGD",
#optimizer="SGD",
#optimizer_opts=dict(lr=100., decay=1e-6, momentum=0.9),
#optimizer_opts=dict(lr=100., decay=1e-6, momentum=0.9),
earlystopping_opts
=
dict
(
monitor
=
'
val_loss
'
,
earlystopping_opts
=
dict
(
monitor
=
'
val_loss
'
,
min_delta
=
0
,
patience
=
2
,
verbose
=
0
,
mode
=
'
auto
'
),
min_delta
=
0
,
patience
=
2
,
verbose
=
0
,
mode
=
'
auto
'
),
selection
=
"
lep1Pt<5000
"
,
# cut out a few very weird outliers
selection
=
"
lep1Pt<5000
"
,
# cut out a few very weird outliers
branches
=
[
"
met
"
,
"
mt
"
],
branches
=
[
"
met
"
,
"
mt
"
],
weight_expr
=
"
eventWeight*genWeight
"
,
weight_expr
=
"
eventWeight*genWeight
"
,
identifiers
=
[
"
DatasetNumber
"
,
"
EventNumber
"
],
identifiers
=
[
"
DatasetNumber
"
,
"
EventNumber
"
],
step_bkg
=
100
)
step_bkg
=
100
)
np
.
random
.
seed
(
42
)
np
.
random
.
seed
(
42
)
c
.
train
(
epochs
=
20
)
c
.
train
(
epochs
=
20
)
...
...
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