def train_model(self, epochs, batch_size=32):
    model = self.build_model()
    if (self.load_model == False):
        modelcheckpoint = ModelCheckpoint(filepath='logs/1-14_autoencoder.epoch{epoch:02d}.h5', monitor='val_loss', save_best_only=True)
        history = model.fit(x=self.X_train, y=self.X_train, epochs=epochs, batch_size=32, validation_data=(self.X_val, self.X_val), callbacks=[EarlyStopping('val_loss', patience=8), modelcheckpoint])
        self.evaluate_model(model)
    else:
        model.load_weights(self.weights_path)
        print(f'model = {model}')
        self.get_bottleneck_values(model)
    return model
def train_model(self, epochs, batch_size=32):
    model = self.build_model()
    if (self.load_model == False):
        modelcheckpoint = ModelCheckpoint(filepath='logs/1-14_autoencoder.epoch{epoch:02d}.h5', monitor='val_loss', save_best_only=True)
        history = model.fit(x=self.X_train, y=self.X_train, epochs=epochs, batch_size=32, validation_data=(self.X_val, self.X_val), callbacks=[EarlyStopping('val_loss', patience=8), modelcheckpoint])
        self.evaluate_model(model)
    else:
        model.load_weights(self.weights_path)
        print(f'model = {model}')
        self.get_bottleneck_values(model)
    return model