Skip to content
Snippets Groups Projects
Commit 401e4426 authored by Nikolai.Hartmann's avatar Nikolai.Hartmann
Browse files

option to ignore negative weight events

parent 7007d7c0
No related branches found
No related tags found
No related merge requests found
...@@ -188,6 +188,8 @@ class ClassificationProject(object): ...@@ -188,6 +188,8 @@ class ClassificationProject(object):
:param normalize_weights: normalize the weights to mean 1 :param normalize_weights: normalize the weights to mean 1
:param ignore_neg_weights: ignore events with negative weights in training (default: False)
""" """
...@@ -257,7 +259,8 @@ class ClassificationProject(object): ...@@ -257,7 +259,8 @@ class ClassificationProject(object):
loss='binary_crossentropy', loss='binary_crossentropy',
mask_value=None, mask_value=None,
apply_class_weight=True, apply_class_weight=True,
normalize_weights=True): normalize_weights=True,
ignore_neg_weights=False):
self.name = name self.name = name
self.signal_trees = signal_trees self.signal_trees = signal_trees
...@@ -339,6 +342,7 @@ class ClassificationProject(object): ...@@ -339,6 +342,7 @@ class ClassificationProject(object):
self.mask_value = mask_value self.mask_value = mask_value
self.apply_class_weight = apply_class_weight self.apply_class_weight = apply_class_weight
self.normalize_weights = normalize_weights self.normalize_weights = normalize_weights
self.ignore_neg_weights = ignore_neg_weights
self.s_train = None self.s_train = None
self.b_train = None self.b_train = None
...@@ -437,6 +441,10 @@ class ClassificationProject(object): ...@@ -437,6 +441,10 @@ class ClassificationProject(object):
selection=self.selection, selection=self.selection,
start=1, step=self.step_bkg, stop=self.stop_test) start=1, step=self.step_bkg, stop=self.stop_test)
if self.ignore_neg_weights:
self.s_train = self.s_train[self.s_train[self.weight_expr]>0]
self.b_train = self.b_train[self.b_train[self.weight_expr]>0]
self.rename_fields(self.s_train) self.rename_fields(self.s_train)
self.rename_fields(self.b_train) self.rename_fields(self.b_train)
self.rename_fields(self.s_test) self.rename_fields(self.s_test)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment