def adverse_validation(dev, batchez, glove): samples = len(batchez[1]) discriminator = am.discriminator(glove, 50) ad_model = am.adverse_model(discriminator) res = ad_model.fit([dev[1][:samples], batchez[1]], np.zeros(samples), validation_split=0.1, verbose = 0, nb_epoch = 20, callbacks = [EarlyStopping(patience=2)]) return np.min(res.history['val_loss'])
def adverse_model_train(model_dir, train, aug_train, dev, aug_dev, dim, glove): discriminator = am.discriminator(glove, dim) ad_model = am.adverse_model(discriminator) dev_len = len(aug_dev[1]) res = ad_model.fit([train[1], aug_train[1]], np.zeros(len(train[1])), validation_data=([dev[1][:dev_len], aug_dev[1]], np.zeros(dev_len)), verbose = 1, nb_epoch = 5) discriminator.save_weights(model_dir + '/adverse.weights')
def adverse_validation(dev, batchez, glove): samples = len(batchez[1]) discriminator = am.discriminator(glove, 50) ad_model = am.adverse_model(discriminator) res = ad_model.fit([dev[1][:samples], batchez[1]], np.zeros(samples), validation_split=0.1, verbose=0, nb_epoch=20, callbacks=[EarlyStopping(patience=2)]) return np.min(res.history['val_loss'])