'Called when training is about to begin
Arguments:
callback_data (HDF5 dataset): shared data between callbacks
model (Model): model object
epochs (int): Total epochs'

def on_train_begin(self, callback_data, model, epochs):

    assert isinstance(model.cost, Multicost), 'Cost    must    be    a    Multicost'
    self.ncosts = len(model.cost.costs)
    self.ncosts_allbranches = sum([self.recursive_multicost_len(c) for c in model.cost.costs])
    points = callback_data['config'].attrs['total_minibatches']
    callback_data.create_dataset('multicost/train', (points, self.ncosts), dtype='float64')
    callback_data.create_dataset('multicost/train_allbranches', (points, self.ncosts_allbranches), dtype='float64')
    self.wsz = min(points, self.wsz)
    self.cost_history = deque([], maxlen=int(self.wsz))
    callback_data['multicost/train'].attrs['time_markers'] = 'minibatch'
    callback_data['multicost/train_allbranches'].attrs['time_markers'] = 'minibatch'
