SHARE
TWEET

Untitled

a guest Jul 19th, 2019 73 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. network = models.Sequential()
  2. network.add(layers.Dense(units=64, activation='relu', input_shape=(len(features.columns),)))
  3. network.add(layers.Dense(units=32, activation='relu'))
  4. network.add(layers.Dense(units=1, activation='sigmoid'))
  5.  
  6. network.compile(loss='binary_crossentropy', optimizer='adam', metrics=['accuracy'])
  7.  
  8. es = EarlyStopping(monitor='val_loss', mode='min', verbose=0, patience=500)
  9. mc = ModelCheckpoint('data/best_model.h5', monitor='val_loss', mode='min', verbose=2, save_best_only=True)
  10.  
  11. history = network.fit(train_features, train_target,
  12.             epochs=1000, verbose=0, batch_size=128,
  13.             validation_data=(test_features, test_target), callbacks=[es, mc])
  14.  
  15. saved_model = load_model('data/best_model.h5')
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top