Belle II Software  release-05-02-19
TfDataBasf2 Class Reference

Public Member Functions

def __init__ (self, train_x, train_y, valid_x, valid_y, batch_size, seed=None, epoch_random_shuffle=True)
 
def sanitize_labels (self)
 
def batch_iterator (self)
 

Public Attributes

 train_x
 training features
 
 train_y
 training targets
 
 valid_x
 validation features
 
 valid_y
 validation targets
 
 batch_size
 batch size
 
 seed
 random generator seed
 
 epoch_random_shuffle
 bool, enables shuffling
 
 train_events
 number of training events
 
 valid_events
 number of validation events
 
 feature_number
 number of features
 
 batches
 number of batches
 
 train_idx
 idices required for shuffling
 
 batch_train_x
 np ndarray for training batch features
 
 batch_train_y
 np ndarray for training batch of targets
 
 random_state
 set random generator
 

Detailed Description

handles data, necessary for the training

Definition at line 19 of file TfData.py.

Constructor & Destructor Documentation

◆ __init__()

def __init__ (   self,
  train_x,
  train_y,
  valid_x,
  valid_y,
  batch_size,
  seed = None,
  epoch_random_shuffle = True 
)
declaration of class variables

Definition at line 24 of file TfData.py.

24  def __init__(self, train_x, train_y, valid_x, valid_y, batch_size, seed=None, epoch_random_shuffle=True):
25  """
26  declaration of class variables
27  """
28 
29  self.train_x = train_x
30 
31  self.train_y = train_y
32 
33  self.valid_x = valid_x
34 
35  self.valid_y = valid_y
36 
37 
38  self.batch_size = batch_size
39 
40  self.seed = seed
41 
42  self.epoch_random_shuffle = epoch_random_shuffle
43 
44 
45  self.train_events = self.train_x.shape[0]
46 
47  self.valid_events = self.valid_x.shape[0]
48 
49 
50  self.feature_number = self.train_x.shape[1]
51 
52 
53  self.batches = self.train_x.shape[0] // self.batch_size
54 
55 
56  self.train_idx = np.zeros((self.train_x.shape[0]))
57 
58 
59  self.batch_train_x = np.zeros((self.feature_number, self.batch_size))
60 
61 
62  self.batch_train_y = np.zeros(self.batch_size)
63 
64 
65  self.random_state = np.random.RandomState(seed)
66 
67 
68  self.sanitize_labels()
69 

Member Function Documentation

◆ batch_iterator()

def batch_iterator (   self)
iterator to provide training batches

Definition at line 94 of file TfData.py.

◆ sanitize_labels()

def sanitize_labels (   self)
checks for a binary classification problem
transforms the two class labels to {0,1}

Definition at line 70 of file TfData.py.


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