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
9994f0ad
Commit
9994f0ad
authored
6 years ago
by
Nikolai
Browse files
Options
Downloads
Patches
Plain Diff
starting rnn wrapper
parent
6409522c
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
+42
-0
42 additions, 0 deletions
toolkit.py
with
42 additions
and
0 deletions
toolkit.py
+
42
−
0
View file @
9994f0ad
...
...
@@ -1221,6 +1221,48 @@ class ClassificationProjectDataFrame(ClassificationProject):
pass
class
ClassificationProjectRNN
(
ClassificationProject
):
"""
A little wrapper to use recurrent units for things like jet collections
"""
def
__init__
(
self
,
recurrent_branches
=
None
,
mask_value
=-
999
,
**
kwargs
):
self
.
recurrent_branches
=
recurrent_branches
if
self
.
recurrent_branches
is
None
:
self
.
recurrent_branches
=
[]
self
.
mask_value
=
mask_value
super
(
ClassificationProjectRNN
,
self
).
__init__
()
@property
def
model
():
pass
def
yield_batch
(
self
):
while
True
:
permutation
=
np
.
random
.
permutation
x_train
,
y_train
,
w_train
=
self
.
training_data
n_training
=
len
(
x_train
)
for
batch_start
in
range
(
0
,
n_training
,
self
.
batch_size
):
pass
# # shuffle the entries for this class label
# rn_state = np.random.get_state()
# x_train[y_train==class_label] = np.random.permutation(x_train[y_train==class_label])
# np.random.set_state(rn_state)
# w_train[y_train==class_label] = np.random.permutation(w_train[y_train==class_label])
# # yield them batch wise
# for start in range(0, len(x_train[y_train==class_label]), int(self.batch_size/2)):
# yield (x_train[y_train==class_label][start:start+int(self.batch_size/2)],
# y_train[y_train==class_label][start:start+int(self.batch_size/2)],
# w_train[y_train==class_label][start:start+int(self.batch_size/2)]*self.balanced_class_weight[class_label])
# restart
if
__name__
==
"
__main__
"
:
logging
.
basicConfig
()
...
...
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