callbacks._set_model(model)
    callbacks._set_params({
        'batch_size': batch_size,
        'nb_epoch': nb_epoch,
        'nb_sample': nb_train_sample,
        'verbose': 1,
        'do_validation': do_validation,
        'metrics': metrics,
    })

    ##########################
    # TRAINING
    ##########################
    callbacks.on_train_begin()

    model.stop_training = False
    for epoch in range(nb_epoch):
        callbacks.on_epoch_begin(epoch)

        if shuffle_on_epoch_start:
            X_train, y_train = util.shuffle_data(X_train, y_train)

        # train
        util.train_on_batch(model, X_train, y_train, nb_classes,
                            callbacks=callbacks,
                            normalize=normalize_data,
                            batch_size=batch_size,
                            class_weight=class_weight,
                            shuffle=False)

        epoch_logs = {}