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
dc93ef02
Commit
dc93ef02
authored
6 years ago
by
Nikolai
Browse files
Options
Downloads
Plain Diff
Merge remote-tracking branch 'origin/master'
parents
a396d67b
8dc10a7e
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
toolkit.py
+10
-4
10 additions, 4 deletions
toolkit.py
utils.py
+2
-0
2 additions, 0 deletions
utils.py
with
12 additions
and
4 deletions
toolkit.py
+
10
−
4
View file @
dc93ef02
...
@@ -108,7 +108,7 @@ class ClassificationProject(object):
...
@@ -108,7 +108,7 @@ class ClassificationProject(object):
:param layers: number of layers in the neural network
:param layers: number of layers in the neural network
:param nodes: number of nodes in each layer
:param nodes:
list
number of nodes in each layer
. If only a single number is given, use this number for every layer
:param dropout: dropout fraction after each hidden layer. Set to None for no Dropout
:param dropout: dropout fraction after each hidden layer. Set to None for no Dropout
...
@@ -236,6 +236,12 @@ class ClassificationProject(object):
...
@@ -236,6 +236,12 @@ class ClassificationProject(object):
self
.
identifiers
=
identifiers
self
.
identifiers
=
identifiers
self
.
layers
=
layers
self
.
layers
=
layers
self
.
nodes
=
nodes
self
.
nodes
=
nodes
if
not
isinstance
(
self
.
nodes
,
list
):
self
.
nodes
=
[
self
.
nodes
for
i
in
range
(
self
.
layers
)]
if
len
(
self
.
nodes
)
!=
self
.
layers
:
self
.
layers
=
len
(
self
.
nodes
)
logger
.
warning
(
"
Number of layers not equal to the given nodes
"
"
per layer - adjusted to
"
+
str
(
self
.
layers
))
self
.
dropout
=
dropout
self
.
dropout
=
dropout
self
.
batch_size
=
batch_size
self
.
batch_size
=
batch_size
self
.
validation_split
=
validation_split
self
.
validation_split
=
validation_split
...
@@ -583,10 +589,10 @@ class ClassificationProject(object):
...
@@ -583,10 +589,10 @@ class ClassificationProject(object):
self
.
_model
=
Sequential
()
self
.
_model
=
Sequential
()
# first hidden layer
# first hidden layer
self
.
_model
.
add
(
Dense
(
self
.
nodes
,
input_dim
=
len
(
self
.
fields
),
activation
=
self
.
activation_function
))
self
.
_model
.
add
(
Dense
(
self
.
nodes
[
0
]
,
input_dim
=
len
(
self
.
fields
),
activation
=
self
.
activation_function
))
# the other hidden layers
# the other hidden layers
for
layer_number
in
range
(
self
.
layers
-
1
):
for
node_count
,
layer_number
in
zip
(
self
.
nodes
[
1
:],
range
(
self
.
layers
-
1
)
)
:
self
.
_model
.
add
(
Dense
(
self
.
nodes
,
activation
=
self
.
activation_function
))
self
.
_model
.
add
(
Dense
(
node_count
,
activation
=
self
.
activation_function
))
if
self
.
dropout
is
not
None
:
if
self
.
dropout
is
not
None
:
self
.
_model
.
add
(
Dropout
(
rate
=
self
.
dropout
))
self
.
_model
.
add
(
Dropout
(
rate
=
self
.
dropout
))
# last layer is one neuron (binary classification)
# last layer is one neuron (binary classification)
...
...
This diff is collapsed.
Click to expand it.
utils.py
+
2
−
0
View file @
dc93ef02
...
@@ -6,6 +6,7 @@ import numpy as np
...
@@ -6,6 +6,7 @@ import numpy as np
import
keras.backend
as
K
import
keras.backend
as
K
from
sklearn.preprocessing
import
RobustScaler
from
sklearn.preprocessing
import
RobustScaler
from
sklearn.preprocessing.data
import
_handle_zeros_in_scale
from
meme
import
cache
from
meme
import
cache
...
@@ -140,5 +141,6 @@ class WeightedRobustScaler(RobustScaler):
...
@@ -140,5 +141,6 @@ class WeightedRobustScaler(RobustScaler):
wqs
=
np
.
array
([
weighted_quantile
(
X
[:,
i
],
[
0.25
,
0.5
,
0.75
],
sample_weight
=
weights
)
for
i
in
range
(
X
.
shape
[
1
])])
wqs
=
np
.
array
([
weighted_quantile
(
X
[:,
i
],
[
0.25
,
0.5
,
0.75
],
sample_weight
=
weights
)
for
i
in
range
(
X
.
shape
[
1
])])
self
.
center_
=
wqs
[:,
1
]
self
.
center_
=
wqs
[:,
1
]
self
.
scale_
=
wqs
[:,
2
]
-
wqs
[:,
0
]
self
.
scale_
=
wqs
[:,
2
]
-
wqs
[:,
0
]
self
.
scale_
=
_handle_zeros_in_scale
(
self
.
scale_
,
copy
=
False
)
return
self
return
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