Belle II Software release-09-00-00
batch_generator Class Reference

Public Member Functions

def __init__ (self, X, Y, Z)
 
def next_batch (self, batch_size)
 

Public Attributes

 X
 Input Features.
 
 Y
 Label data.
 
 Z
 Spectatirs/Quantity to be uncorrelated to.
 
 len
 Length of the data.
 
 index_array
 Index array containing indices from 0 to len.
 
 pointer
 Pointer to the current start of the batch.
 

Detailed Description

Class to create batches for training the Adversary Network.
Once the steps_per_epoch argument is available for the fit function in keras, this class will become obsolete.

Definition at line 34 of file adversary_network.py.

Constructor & Destructor Documentation

◆ __init__()

def __init__ (   self,
  X,
  Y,
  Z 
)
Init the class
:param X: Input Features
:param Y: Label Data
:param Z: Spectators/Quantity to be uncorrelated to

Definition at line 40 of file adversary_network.py.

40 def __init__(self, X, Y, Z):
41 """
42 Init the class
43 :param X: Input Features
44 :param Y: Label Data
45 :param Z: Spectators/Quantity to be uncorrelated to
46 """
47
48 self.X = X
49
50 self.Y = Y
51
52 self.Z = Z
53
54 self.len = len(Y)
55
56 self.index_array = np.arange(self.len)
57
58 self.pointer = 0
59

Member Function Documentation

◆ next_batch()

def next_batch (   self,
  batch_size 
)
Getting next batch of training data

Definition at line 60 of file adversary_network.py.

60 def next_batch(self, batch_size):
61 """
62 Getting next batch of training data
63 """
64 if self.pointer + batch_size >= self.len:
65 np.random.shuffle(self.index_array)
66 self.pointer = 0
67
68 batch_index = self.index_array[self.pointer:self.pointer + batch_size]
69 self.pointer += batch_size
70
71 return self.X[batch_index], self.Y[batch_index], self.Z[batch_index]
72
73

Member Data Documentation

◆ index_array

index_array

Index array containing indices from 0 to len.

Definition at line 56 of file adversary_network.py.

◆ len

len

Length of the data.

Definition at line 54 of file adversary_network.py.

◆ pointer

pointer

Pointer to the current start of the batch.

Definition at line 58 of file adversary_network.py.

◆ X

X

Input Features.

Definition at line 48 of file adversary_network.py.

◆ Y

Y

Label data.

Definition at line 50 of file adversary_network.py.

◆ Z

Z

Spectatirs/Quantity to be uncorrelated to.

Definition at line 52 of file adversary_network.py.


The documentation for this class was generated from the following file: