17 handles data, necessary for the training
20 def __init__(self, train_x, train_y, valid_x, valid_y, batch_size, seed=None, epoch_random_shuffle=True):
22 declaration of class variables
25 self.
train_xtrain_x = train_x.astype(np.float32)
27 self.
train_ytrain_y = train_y.astype(np.float32)
29 self.
valid_xvalid_x = valid_x.astype(np.float32)
31 self.
valid_yvalid_y = valid_y.astype(np.float32)
68 checks for a binary classification problem
69 transforms the two class labels to {0,1}
72 assert len(np.unique(self.
train_ytrain_y)) == 2
74 assert np.array_equal(np.unique(self.
train_ytrain_y), np.unique(self.
valid_yvalid_y))
77 if self.
train_ytrain_y.min() > 0:
81 if self.
train_ytrain_y.max() != 1:
86 if self.
train_ytrain_y.min() != 0:
92 iterator to provide training batches
99 for i
in range(self.
batchesbatches):
108 stub class just for initializing in basf2 begin_run
111 def __init__(self, batch_size, feature_number, event_number, train_fraction):
113 declare for initialization required batch parameters
128 self.
valid_eventsvalid_events = int((1 - train_fraction) * event_number)
train_events
number of training training events
def __init__(self, batch_size, feature_number, event_number, train_fraction)
feature_number
feature number
valid_events
number of validation events
epoch_random_shuffle
bool, enables shuffling
random_state
set random generator
valid_y
validation targets
train_events
number of training events
def __init__(self, train_x, train_y, valid_x, valid_y, batch_size, seed=None, epoch_random_shuffle=True)
seed
random generator seed
def sanitize_labels(self)
batch_train_y
np ndarray for training batch of targets
valid_x
validation features
train_idx
indices required for shuffling
feature_number
number of features
valid_events
number of validation events
batch_train_x
np ndarray for training batch features